Exemple #1
0
        public override int Calculate(AIManager ai)
        {
            int r = 0;

            if (ai.currentPlayer == null || ai.currentPlayer.mTransform == null)
            {
                return(0);
            }

            float distance = Vector3.Distance(ai.states.mTransform.position, ai.currentPlayer.mTransform.position);

            //Debug.Log("distance is " + distance);
            if (distance < radius)
            {
                Vector3 direction = ai.currentPlayer.mTransform.position - ai.states.mTransform.position;

                angle = Vector3.Angle(ai.states.mTransform.forward, direction);

                if (!allAnglesPositive)
                {
                    float dot = Vector3.Dot(ai.states.mTransform.right, direction);
                    if (dot < 0)
                    {
                        angle *= -1;
                    }
                }

                if (angle >= minAngle && angle <= maxAngle)
                {
                    r = positiveValue;
                }
            }



            return(r);
        }
Exemple #2
0
 public override int Calculate(AIManager ai)
 {
     return(score);
 }
 public abstract int Calculate(AIManager ai);
Exemple #4
0
 public override void Tick(AIManager ai)
 {
 }
Exemple #5
0
 public abstract void Tick(AIManager ai);
Exemple #6
0
 public override void Tick(AIManager ai)
 {
     ai.currentActionsHolder = holder;
 }
Exemple #7
0
 public override void Tick(AIManager ai)
 {
     ai.targetDestination = ai.currentPlayer.mTransform.position;
     ai.agent.SetDestination(ai.targetDestination);
 }