예제 #1
0
 void OnTriggerEnter(Collider collider)
 {
     if (collider.transform.tag.ToLower() == "player")
     {
         agent.TakeAwayPoints();
     }
 }
예제 #2
0
    void OnTriggerEnter(Collider collider)
    {
        if (collider.transform.tag.ToLower() == "player" && !HasCarUsedIt)
        {
            agent = transform.parent.GetComponentInChildren <CarAgent>();

            if (goalType == GoalType.Milestone)
            {
                HasCarUsedIt = true;
                agent.GivePoints(goalReward);
            }
            else
            {
                // this will ensure the car tries to align when parking
                if (Mathf.Abs(agent.transform.rotation.y) <= goalMinRotation || !enforceGoalMinRotation)
                {
                    HasCarUsedIt = true;
                    agent.GivePoints(goalReward, true);
                }
                else
                {
                    agent.TakeAwayPoints();
                }
            }
        }
    }