public bool Move(NeoParticleProcessor processor) { if (lifeTimer.OnLimit()) { processor.AddRemainShots(shots); for (int i = 0; i < shots.Count; i++) { shots[i].Period(); } return(false); } if (moveCounter.Count()) { Refract(); InitializeMovement(); if (shot != null) { shot.Period(); } shot = processor.GenerateShot(target); shots.Add(shot); } var newShots = new List <NeoShot>(); for (int i = 0; i < shots.Count; i++) { if (shots[i].Ray(target.localPosition)) { newShots.Add(shots[i]); } else { processor.PoolShot(shots[i]); } } shots = newShots; float rate = processor.Easing.Easing(moveCounter.Limit, moveCounter.Now, info.easingID); target.localPosition = basePos + moveVector * rate; return(true); }
public NeoShot GenerateShot(Transform t) { if (!haveShot) { return(null); } GameObject g = shotPool.Pop(); if (!g) { g = Instantiate(shotOrigin, transform); } g.transform.position = t.position; g.transform.eulerAngles = t.eulerAngles; NeoShot shot = new NeoShot(t.localPosition, g.transform, shotInfo); return(shot); }
public void PoolShot(NeoShot shot) { shotPool.Push(shot.Target.gameObject); }