mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
Bullets pooling
This commit is contained in:
parent
37bcf8b2d0
commit
fa3805ecfe
18 changed files with 280 additions and 69 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using Cirno.Scripts.Controllers;
|
||||
using Cirno.Scripts.Weapons;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
|
@ -22,10 +23,9 @@ public partial class BulletSpawner : Node2D
|
|||
|
||||
for (int i = 0; i < bulletInfo.BulletCount; i++)
|
||||
{
|
||||
if (bulletInfo.IsLaser)
|
||||
bullet = this.CreateChildOf<LaserBullet>(_gameManager.BulletsContainer, bulletScene, bulletInfo.Position);
|
||||
else
|
||||
bullet = this.CreateChildOf<Bullet>(_gameManager.BulletsContainer, bulletScene, bulletInfo.Position);
|
||||
// bullet = this.CreateChildOf<Bullet>(_gameManager.BulletsContainer, bulletScene, bulletInfo.Position);
|
||||
bullet = PoolingManager.Instance.SpawnBullet(bulletInfo.OriginalBulletResource);
|
||||
bullet.GlobalPosition = bulletInfo.Position;
|
||||
|
||||
// var bullet = this.CreateChildOf<Bullet>(_gameManager.BulletsContainer, bulletInfo.BulletScene ?? BulletScene, bulletInfo.Position);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue