Ejemplo n.º 1
0
        public void Spawn(Sprite[] effect, Vector2 position, Vector2 velocity, int depthOffset = 0)
        {
            sprite.frames = effect;
            // sprite expects a valid frame number, length is the last frame + 1.
            sprite.returnTo = effect.Length - 1;
            sprite.Play();
            sprite.depthOffset = depthOffset;

            this.position             = position;
            sprite.transform.position = new Vector3(
                Mathf.Round(this.position.x * S.SIZE),
                Mathf.Round(this.position.y * S.SIZE)
                );
            this.velocity = velocity;

            timer = new FrameTimer(effect.Length * AS.FRAME_DURATION);
            timer.Start();

            active = true;
            sprite.Show();
        }