Example #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);
        }
Example #2
0
 public override int Calculate(AIManager ai)
 {
     return(score);
 }
Example #3
0
 public abstract int Calculate(AIManager ai);
Example #4
0
 public override void Tick(AIManager ai)
 {
 }
Example #5
0
 public abstract void Tick(AIManager ai);
Example #6
0
 public override void Tick(AIManager ai)
 {
     ai.currentActionsHolder = holder;
 }
Example #7
0
 public override void Tick(AIManager ai)
 {
     ai.targetDestination = ai.currentPlayer.mTransform.position;
     ai.agent.SetDestination(ai.targetDestination);
 }