Example #1
0
        public void Influence(Influence influence)
        {
            if (influence.StartToListen())
            {
                startedToListen = true;
            }

            if (influence.Die())
            {
                dead = true;
                animator.StartAnimation(Animation.EXPLOSION, state.GetDirection(), () =>
                {
                    afterimaging.StopShowingAfterimages();
                    instantiater.Clone();
                });
            }

            if (influence.StartMoving())
            {
                state.StartMoving();
            }

            if (influence.StopMoving())
            {
                state.StopMoving();
            }

            if (influence.TurnAround())
            {
                state.TurnAround();
            }

            bonusSpeed    += influence.HorizontalMovement();
            verticalSpeed += influence.VerticalMovement();

            Move(new Vector2(influence.Reposition().x, influence.Reposition().y));

            Vector2?place = influence.Place();

            if (place != null)
            {
                transform.position = (Vector2)place;
            }
        }