public void Shoot() { if (model.lastShot + model.fireInterval < Time.timeSinceLevelLoad) { model.lastShot = Time.timeSinceLevelLoad; ControllerBullet controllerBullet = ServiceBullet.Instance.MakeBullet(model.bulletType); controllerBullet.SetShooter(this); controllerBullet.Shoot(view.muzzle.transform); } }
public ControllerBullet MakeBullet(BulletTypes bulletType) { ControllerBullet temp = null; switch (bulletType) { case BulletTypes.defaultBullet: temp = new ControllerDefaultBullet(); bulletList.Add(temp); break; case BulletTypes.fastBullet: temp = new ControllerFastBullet(); bulletList.Add(temp); break; case BulletTypes.explossiveBullet: temp = new ControllerExplossiveBullet(); bulletList.Add(temp); break; } temp.OnBulletDestroy += RemoveBullet; // Debug.Log(bulletList.Count); return(temp); }
public void RemoveBullet(ControllerBullet temp) { //Debug.Log(bulletList.Count); // bulletList.Remove(temp); bulletList.Remove(temp); }