Beispiel #1
0
        public Data(Unit_AI myself)
        {
            Myself       = myself;
            Player       = GameManager.Player;
            PlayerParams = Player.UnitAnimator.Params;
            unitpf       = myself.PF;
            idlePosition = myself.transform.position;

            Player.CombatHandler.AttackHandler.OnAttackAnimationStarted.AddListener(SetOnAttackAnimationStartedTrue);
            Player.CombatHandler.AttackHandler.OnConsecutiveAttack.AddListener(SetOnAttackAnimationStartedTrue);

            Params = myself.UnitAnimator.Params;
        }
Beispiel #2
0
        public DoMoveTowardPosition(Unit_Animator_Params param, ref Quaternion myRotation
                                    , Vector3 myPosition, Vector3 destination, float rotationSpeed
                                    , float movementVelocity, float distanceToDestination, float distanceStop)
        {
            var directionTowardDestination = Vector3.Normalize(destination - myPosition);

            new DoRotateTowardPlayer(ref myRotation, directionTowardDestination, rotationSpeed);

            if (distanceToDestination > distanceStop)
            {
                new DoAccelerate(param, movementVelocity);
            }
            else
            {
                new DoDecelerate(param, movementVelocity);
            }
        }
Beispiel #3
0
 public DoDecelerate(Unit_Animator_Params param, float velocity)
 {
     param.Movement = Mathf.Max(0.0f, param.Movement - velocity);
 }