SebastianLawe

Untitled

Sep 20th, 2015
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.64 KB | None | 0 0
  1.  // If the game mode is CTF
  2.             if (teamManager.gameType == GameType.CTF) {
  3.                 // Search for all flags
  4.                 foreach (EventReactor reactor in FindObjectsOfType<EventReactor>()) {
  5.                     // Is this flag a different colour than us?
  6.                     if (reactor.factionManager.color != manager.color) {
  7.                         // Is this flag captured?
  8.                         if (reactor.flagCaptured) {
  9.                             // Did we capture this flag?
  10.                             if (reactor.currentPlayer == this) {
  11.                                 // Set out target to this flags enemy flag. Which is our flag.
  12.                                 target = reactor.opposingFlag.transform;
  13.                             } else {
  14.                                 // The flag has been captured, escort the person who captured it.
  15.                                 target = reactor.currentPlayer.FactionManager.transform;
  16.                             }
  17.                         } else {
  18.                             // Lets capture the flag!
  19.                             target = reactor.transform;
  20.                         }
  21.                     }
  22.                     // Is this flag ours?
  23.                     if (reactor.factionManager.color == manager.color) {
  24.                         // Is this flag captured?
  25.                         if (reactor.flagCaptured) {
  26.                             // The flag has been captured, stop whoever stole it!
  27.                             target = reactor.currentPlayer.FactionManager.transform;
  28.                         }
  29.                     }
  30.                 }
  31.             }
Advertisement
Add Comment
Please, Sign In to add comment