void OnTriggerEnter(Collider collider) { if (collider.transform.tag.ToLower() == "player") { agent.TakeAwayPoints(); } }
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(); } } } }