Ejemplo n.º 1
0
    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);
    }
Ejemplo n.º 2
0
    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);
    }
Ejemplo n.º 3
0
 public void PoolShot(NeoShot shot)
 {
     shotPool.Push(shot.Target.gameObject);
 }