mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-11 15:25:55 +00:00
Bullets pooling
This commit is contained in:
parent
37bcf8b2d0
commit
fa3805ecfe
18 changed files with 280 additions and 69 deletions
|
|
@ -3,6 +3,7 @@ using System;
|
|||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using Cirno.Scripts;
|
||||
using Cirno.Scripts.Controllers;
|
||||
using Cirno.Scripts.Resources;
|
||||
using Godot.Collections;
|
||||
|
||||
|
|
@ -78,7 +79,11 @@ public partial class Barrel : Area2D, IDestructible
|
|||
{
|
||||
if (ExplosionData == null) return;
|
||||
|
||||
var explosion = this.CreateSibling<Bullet>(ExplosionData.BulletScene);
|
||||
|
||||
var explosion = PoolingManager.Instance.SpawnBullet(ExplosionData);
|
||||
explosion.GlobalPosition = this.GlobalPosition;
|
||||
|
||||
//var explosion = this.CreateSibling<Bullet>(ExplosionData.BulletScene);
|
||||
explosion.Speed = 0;
|
||||
|
||||
explosion.Initialize(ExplosionData.MakeBullet(this.GlobalPosition), _gameManager);
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@
|
|||
script = ExtResource("4_u1i8n")
|
||||
EggIndex = 0
|
||||
StartingEquipment = Array[ExtResource("2_g20dv")]([ExtResource("3_6314l")])
|
||||
RemoveEquipment = Array[ExtResource("2_g20dv")]([])
|
||||
RemoveEquipment = []
|
||||
metadata/_custom_type_script = "uid://mja0rk7n2kln"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_1tvdd"]
|
||||
|
|
|
|||
9
Scenes/Utils/pooling_manager.tscn
Normal file
9
Scenes/Utils/pooling_manager.tscn
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://c3t8rhwwdo5cl"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://k1pdoan4wie2" path="res://Scripts/Controllers/PoolingManager.cs" id="1_ji88p"]
|
||||
|
||||
[node name="PoolingManager" type="Node2D"]
|
||||
z_index = 1
|
||||
script = ExtResource("1_ji88p")
|
||||
PoolOnStart = Array[Resource]([])
|
||||
DebugView = true
|
||||
Loading…
Add table
Add a link
Reference in a new issue