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