Ejemplo n.º 1
0
 // Collision triggers for waypoints and world events
 public void OnTriggerEnter(Collider trigger)
 {
     // Debug.Log ("I'm so triggered!");
     // Solved a bug with NPCs triggering each other and getting confused. This would've lead to weird pathing
     if (trigger.gameObject.tag != "NPC") {
         // Get the current position based on the waypoint we just hit
         currentWaypoint = trigger.gameObject.GetComponent <WayPoint> ();
         // If the waypoint isn't a trap, world event, or the finish line
         if (currentWaypoint.wpType != WaypointType.Trap && currentWaypoint.wpType != WaypointType.WorldEvent && currentWaypoint.wpType != WaypointType.Finish) {
             if (currentWaypoint.visitedBy [ident - 1] != true) {
                 currWpNum++;
                 nextWaypoint = waypointList [currWpNum + 1];
                 currentWaypoint.visitedBy [ident - 1] = true;
                 // House waypoint
                 if (currentWaypoint.wpType == WaypointType.House) {
                     waypointList [currWpNum - 1].visitedBy [ident - 1] = false;
                     nextWaypoint = waypointList [currWpNum - 1];
                     currWpNum--;
                     currentWaypoint.visitedBy [ident - 1] = true;
                     gameController.AtHouse (ident);
                     if (!isNaked)
                         candyCounter += currentWaypoint.candyAmount;
                 }
                 SetTarget ();
             }
         } else if (currentWaypoint.wpType == WaypointType.Trap) {
             // Debug.Log ("Trap!");
             // If the waypoint is a trap
             gameController.AtTrap(currentWaypoint.TrapTime ());
             candyCounter += currentWaypoint.candyAmount;
             if (currentWaypoint.MakeNude()) {
                 ToggleNude ();
             }
         } else if (currentWaypoint.wpType == WaypointType.Finish) {
             FinishLine ();
         }
     }
 }