Advertisement
Guest User

RoomController

a guest
May 30th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 108.08 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using Hashtable = ExitGames.Client.Photon.Hashtable; //Replace default Hashtables with Photon hashtables
  5. using SuperApi;
  6. using Steamworks;
  7. using LapinerTools.uMyGUI;
  8. public class RoomController : Photon.MonoBehaviour
  9. {
  10. public bool bombPlanted = false;
  11. public bool isKickedForPing = false;
  12. public enablecappoint hardPointELM;
  13. public GameObject Zombies;
  14. public bool cursorLocked;
  15. public GameObject Bomb;
  16. public Transform explosion;
  17. //This is main script that control in-room logic
  18. public Texture confirmedkill;
  19. public int killSteakXP = 0;
  20. public int startTime = 45;
  21. public GameObject[] spectatorCameras;
  22. public AudioClip healthSFX;
  23. bool showWeaponText = false;
  24. //*Ranking Info
  25. float infoCount = 3;
  26. int ranker_score;
  27. public int rank_number;
  28. public Texture currentRank;
  29. public Texture nextRank;
  30. public Texture rank_private;
  31. public Texture rank_pvf;
  32. public Texture rank_corporal;
  33. public Texture sgt;
  34. public Texture sgj_major;
  35. public Texture master_sgt;
  36. public Texture lt1;
  37. public Texture lt2;
  38. public Texture rank_captain;
  39. public Texture lt_major;
  40. public Texture major;
  41. public Texture colonel;
  42. public Texture Brigader_general;
  43. public Texture maj_general;
  44. public Texture lt_general;
  45. public Texture general;
  46. public Texture fivestargen;
  47. public bool ranked2;
  48. public bool didRank2;
  49. public int nextrank3 = 50;
  50. public bool ranked3;
  51.  
  52. public int nextrank4 = 100;
  53. public bool ranked4;
  54. public int weapcycle = 0;
  55. public AudioSource ranked;
  56.  
  57. public int nextrank5 = 400;
  58. public bool ranked5;
  59. public bool didRank5;
  60. public int nextrank6 = 600;
  61. public bool ranked6;
  62. public int nextrank7 = 1000;
  63. public bool ranked7;
  64. public int nextrank8 = 1750;
  65. public bool ranked8;
  66. public int nextrank9 = 3000;
  67. public bool ranked9;
  68. public int nextrank10 = 4750;
  69. public bool ranked10;
  70. public int nextrank11 = 6000;
  71. public bool ranked11;
  72. public int nextrank12 = 8500;
  73. public bool ranked12;
  74. public int nextrank13 = 10000;
  75. public bool ranked13;
  76. public int nextrank14 = 13500;
  77. public bool ranked14;
  78. public int nextrank15 = 15500;
  79. public bool ranked15;
  80. public bool ranked16;
  81. public int nextLevel = 0;
  82. //UI In-Game Vital Elements
  83. public Texture clock;
  84. public AudioClip hearbeat;
  85. public int healAfter;
  86. public Texture HPVital;
  87. public Texture HPVitalRed;
  88. public bool healDone = false;
  89. public Texture crouchGuy;
  90. public AudioClip hitmarker;
  91. public GameObject[] zAisDestory;
  92. public int botCount = 0;
  93. public int botKills = 0;
  94. bool freeforallstart;
  95. public AudioClip ffaAudio;
  96. public AudioClip firstBlood;
  97. public AudioClip hardpointSound;
  98. public bool spawnedPlayer = false;
  99. public int teamaplayersalive = 0;
  100. public int teambplayerslive = 0;
  101. public GameObject[] Ais;
  102. public GameObject[] curAis;
  103. public GameObject ai1;
  104. //Spawn System
  105. public GameObject[] holdupobjects = new GameObject[4];
  106. public int TimeToStartGame = 60;
  107. bool deployweapons;
  108. public bool countingDown;
  109.  
  110. bool dome1MoveTextActive;
  111. bool dome2MoveTextActive;
  112. public int movesIn;
  113. public int movesIn2;
  114. public GameObject Dome1;
  115. public GameObject Dome2;
  116. public GameObject Dome3;
  117. public GameObject Dome4;
  118. public bool lmadead;
  119. //UI In-Game Element Bools
  120. public bool isCrouched;
  121.  
  122. public AudioClip lightingmeup;
  123. public AudioClip gogogo;
  124. public AudioClip[] screams;
  125. public AudioClip[] kills;
  126. public AudioClip[] shouts;
  127. public Material DawnSkybox;
  128. public Material darkSkybox;
  129. public GameObject Lighting;
  130.  
  131. public AudioClip infectedSoundEffect;
  132. public AudioClip machinegunfire1;
  133. public AudioSource soldierShout;
  134. bool playShoutOnce;
  135.  
  136. bool playerHasBeenKilled = false;
  137. public Texture HUDOverlayBG;
  138. public Texture ScoreHUDOVERLAYBG;
  139. public GameObject radarping;
  140. public GameObject radarbg;
  141. public Texture rank2;
  142. public Texture rank3;
  143. public Texture rank4;
  144. public Texture rank5;
  145. public Texture rank6;
  146. public Texture rank7;
  147. public Texture rank8;
  148. public Texture rank9;
  149. public Texture rank10;
  150. public Texture rank11;
  151. public Texture rank12;
  152. public Texture rank13;
  153. public Texture rank14;
  154. public Texture rank15;
  155. public int Victories;
  156. public Texture scoreDisplay;
  157. public bool dead;
  158. public float time2Fade;
  159. public GUIText playerLeft;
  160. public int spawnProtectTime;
  161. public int expireKill = 2;
  162. public bool protectactive;
  163. public GameObject playerPrefab;
  164. public GameObject playerPrefab2;
  165. public Camera welcomeCamera;
  166. public Texture2D blackScreen;
  167. public Texture2D whiteTexture;
  168. public Texture2D shotgunTexture;
  169. //Hit detectors
  170. public Texture2D hitTop;
  171. public Texture2D hitBottom;
  172. public Texture2D hitLeft;
  173. public Texture2D hitRight;
  174. public AudioSource headshot_start;
  175. public AudioClip headshot_sound;
  176. public AudioClip buySound;
  177. public AudioClip cashRegisterSound;
  178.  
  179. public string name;
  180.  
  181. public Camera forge_cam;
  182.  
  183. public int infectTime = Random.Range(10, 20);
  184. bool hasbeenpicked = false;
  185. public int respawnInfectTime = 0;
  186. public int[] infectRandTime;
  187. public Transform spawnpintA;
  188. public Transform spawnPontTmp = null;
  189. //Objects to buy in forge mode
  190. public GameObject barrel1;
  191. public GameObject concrete_block;
  192. public GameObject building1;
  193. public GameObject building2;
  194. public GameObject palette;
  195. public GameObject shipping_container1;
  196. public GameObject shipping_container2;
  197. public GameObject shipping_container3;
  198. public GameObject shipping_container4;
  199.  
  200. //Delcare Spawnpoints in forge mode
  201. public GameObject spawnpntA;
  202. public GameObject spawnpntB;
  203.  
  204. public int ranksforkill;
  205.  
  206. public int recordedKills = 0;
  207. public int recordedDeaths = 0;
  208.  
  209. public AudioSource announcersfx;
  210. public AudioClip gosfx;
  211. public AudioClip almostthere;
  212. public AudioClip soldierdeath1;
  213. public AudioClip holyshitsfx;
  214. public bool createdHardpoint = false;
  215. public GameObject spawnHardPoint;
  216. public GameObject spawnHardPoint2;
  217. public GameObject spawnHardPoint3;
  218. public GameObject hardpoint1;
  219. public GameObject capturepoint1;
  220. public GameObject capturepoint2;
  221. public GameObject capturepoint3;
  222.  
  223. GUIStyle customLabel = new GUIStyle("label");
  224. GUIStyle customLayout1 = new GUIStyle("label");
  225. GUIStyle customLayout2 = new GUIStyle("label");
  226. public bool userKilled;
  227.  
  228. public bool isPurchaseLoaded;
  229.  
  230. string kredsPrefsName = "kredsPrefs";
  231.  
  232. public AudioSource rankupsfx;
  233.  
  234. public bool showIconA;
  235. public bool showIconB;
  236. public int expire;
  237. public Texture TeamAIcon;
  238. public Texture TeamBIcon;
  239.  
  240. public List<Transform> teamASpawnPoints = new List<Transform>();
  241.  
  242. public List<Transform> teamBSpawnPoints = new List<Transform>();
  243. [HideInInspector]
  244. public List<PhotonPlayer> teamAPlayers = new List<PhotonPlayer>();
  245. [HideInInspector]
  246. public List<PhotonPlayer> teamBPlayers = new List<PhotonPlayer>();
  247. [HideInInspector]
  248. public string spectatorNames = "";
  249.  
  250. //Vehicle Controls
  251. public bool enteredVehicleSpot = false;
  252. [HideInInspector]
  253. public bool showScoreBoard = false;
  254. [HideInInspector]
  255. public bool eneteredBuySpot = false;
  256. [HideInInspector]
  257. public bool eneteredBombSpot = false;
  258. [HideInInspector]
  259. public bool leavingRoom = false;
  260. [HideInInspector]
  261. public bool showFPS = false;
  262. [HideInInspector]
  263. public bool showBuyMenu = false;
  264. [HideInInspector]
  265. public bool showOptions;
  266.  
  267. public bool showPauseMenu = false;
  268.  
  269. [HideInInspector]
  270. public PlayerNetwork ourPlayer;
  271. [HideInInspector]
  272. public List<PlayerNetwork> otherPlayers = new List<PlayerNetwork>(); //Keep references of other spawned players
  273.  
  274. Transform welcomeCameraTransform;
  275. Vector3 defaultCamPos;
  276. Quaternion defaultCamRot;
  277.  
  278. //bool playerKilled = false;
  279. [HideInInspector]
  280. public float distance; //Crosshair distance is also set at Weapon.cs when we fire
  281.  
  282. float redScreenFade = 0;
  283. float hitTopFade = 0;
  284. float hitBottomFade = 0;
  285. float hitLeftFade = 0;
  286. float hitRightFade = 0;
  287. bool doingHitDetector = false;
  288. float hitDetectorsDistance = 125;
  289.  
  290. //Get current fps
  291. float updateInterval = 1f;
  292. float accum = 0.0f;
  293. int frames = 0;
  294. float timeleft;
  295. float roundDuration = 0;
  296. public float referenceTime = 0;
  297. //Was = 600;
  298. public float currentRoundTime = 1500;
  299.  
  300. float seconds;
  301. float minutes;
  302. string roundTimeString = "00:00";
  303.  
  304. public SimpleColladaDemo scd;
  305.  
  306. int healthAfter = 2;
  307.  
  308. int count = 0;
  309.  
  310.  
  311. public int teamAScore = 0;
  312.  
  313. public int teamBScore = 0;
  314. [HideInInspector]
  315. public int ourTeam = 0;
  316. [HideInInspector]
  317. public string currentGameMode = "";
  318. [HideInInspector]
  319. public int currentRespawnTime = -1;
  320. [HideInInspector]
  321. public int currentGameStatus = 0;
  322.  
  323. //Used only for FFA (Free For All) mode
  324. [HideInInspector]
  325. public int currentKillLimit;
  326. [HideInInspector]
  327. public int currentScoreLimit;
  328. [HideInInspector]
  329. public PhotonPlayer winningPlayer;
  330.  
  331. public bool createHardPoint = false;
  332.  
  333. [HideInInspector]
  334. private bool cashes_boolean;
  335. [HideInInspector]
  336. public int totalCash = 5;
  337. public int totalGold = 0;
  338. public int LMACash = 0;
  339. public int BMCash = 25000;
  340. public int SRCash = 50000;
  341. public int tweetCashes = 0;
  342. public int savedGP;
  343. public gunShop weaponShop;
  344.  
  345. int previousGameStatus = 0;
  346. bool doneSetup = false;
  347. int waitBeforeRespawn = 1; //How much seconds player need to wait before respawn again
  348. public int currentHP = 0;
  349. public string scoreToAddTmp = "+ 100";
  350. Color addingColor = new Color(0, 1, 0, 0.75f);
  351. Color substractingColor = new Color(1, 0.71f, 0.109f, 0.75f);
  352.  
  353. Color addingColorFadeTo;
  354. Color currentAddingCashColor;
  355. Color currentTotalCashColor;
  356. bool addingKillCash = false;
  357. public GameObject scorezone;
  358. public int totalXP = 0;
  359. public int challengeXP = 0;
  360. public int rank_xp = 0;
  361. public Texture rank_pvt;
  362. public Texture rank_pfc;
  363. public Texture rank_cpl;
  364. public Texture rank_sgt;
  365. public Texture rank_ssgt;
  366. public Texture rank_sgtmaj;
  367. public Texture rank_slt;
  368. int lockState = -1;
  369. public ConnectMenu cm6;
  370. public RoomController rc7;
  371. public Transform spawnPoint;
  372. public GameObject ai;
  373. public GameObject[] spawnPoints;
  374.  
  375.  
  376. public List<GameObject> forgeItems = new List<GameObject>();
  377.  
  378. [System.Serializable]
  379. public class ActionReport
  380. {
  381.  
  382.  
  383. public string leftText;
  384. public string middleText;
  385. public string rightText;
  386. public Color leftTextColor;
  387. public Color rightTextColor;
  388. public float timer; //How long this itema appear on screen in seconds
  389.  
  390. public ActionReport(string lt, string mt, string rt, Color ltc, Color rtc, float t)
  391. {
  392. leftText = lt;
  393. middleText = mt;
  394. rightText = rt;
  395. leftTextColor = ltc;
  396. rightTextColor = rtc;
  397. timer = t;
  398. }
  399. }
  400.  
  401. List<ActionReport> actionReports = new List<ActionReport>();
  402.  
  403. MultiplayerChat mc;
  404. OptionsSettings os;
  405. FPSMouseLook cameraMouseLook;
  406. Scoreboard sb;
  407. BuyMenu bm;
  408.  
  409. Texture2D scopeTexture;
  410. float scopeTextureRatio;
  411. AudioSource audioSource;
  412. int timeToPurchase = 0;
  413. int forgetimeToPurchase = 0;
  414. //Has player spawned in Zombie Escape mod yet?
  415. bool playerSpawnZE = false;
  416. int totalCash2 = 0;
  417.  
  418. //Compare players by kills (sort by list)
  419. private static int SortPlayers(PhotonPlayer A, PhotonPlayer B)
  420. {
  421. return (int)B.customProperties["Kills"] - (int)A.customProperties["Kills"];
  422. }
  423. bool loadedHardpoint = false;
  424. bool isDom;
  425. /*private void Awake()
  426. {
  427. Dome1 = GameObject.Find("Dome");
  428. Dome2 = GameObject.Find("Dome2");
  429. Dome3 = GameObject.Find("Dome3");
  430. Dome4 = GameObject.Find("Dome4");
  431. }
  432. */
  433. // Use this for initialization
  434. IEnumerator Start()
  435. {
  436.  
  437. //if(Application.loadedLevelName == "forge")
  438. //{
  439. //PhotonNetwork.offlineMode = true;
  440. //uMyGUI_PopupManager.Instance.ShowPopup("steam_ugc_browse");
  441. //}
  442. ranker_score = PlayerPrefs.GetInt("totalKill");
  443. if (ranker_score >= 0)
  444. {
  445. rank_number = 1;
  446. currentRank = rank_private;
  447. ranked2 = true;
  448. }
  449.  
  450. if (ranker_score >= 15)
  451. {
  452. PlayerPrefs.SetInt("ranker_number", rank_number);
  453. rank_number = 2;
  454. currentRank = rank_corporal;
  455. ranked2 = false;
  456. ranked3 = true;
  457. }
  458.  
  459. if (ranker_score >= 50)
  460. {
  461. PlayerPrefs.SetInt("ranker_number", rank_number);
  462. rank_number = 3;
  463. currentRank = sgt;
  464. ranked3 = false;
  465. ranked4 = true;
  466. }
  467.  
  468. if (ranker_score >= 100)
  469. {
  470. PlayerPrefs.SetInt("ranker_number", rank_number);
  471. rank_number = 4;
  472. currentRank = lt1;
  473. ranked4 = false;
  474. ranked5 = true;
  475. }
  476.  
  477. if (ranker_score >= 400)
  478. {
  479. PlayerPrefs.SetInt("ranker_number", rank_number);
  480. rank_number = 5;
  481. currentRank = lt2;
  482. ranked5 = false;
  483. ranked6 = true;
  484. }
  485.  
  486. if (ranker_score >= 600)
  487. {
  488. PlayerPrefs.SetInt("ranker_number", rank_number);
  489. rank_number = 6;
  490. currentRank = rank_captain;
  491. ranked6 = false;
  492. ranked7 = true;
  493. }
  494.  
  495. if (ranker_score >= 1000)
  496. {
  497. PlayerPrefs.SetInt("ranker_number", rank_number);
  498. rank_number = 7;
  499. currentRank = lt_major;
  500. ranked7 = false;
  501. ranked8 = true;
  502. }
  503.  
  504. if (ranker_score >= 1750)
  505. {
  506. PlayerPrefs.SetInt("ranker_number", rank_number);
  507. rank_number = 8;
  508. currentRank = major;
  509. ranked8 = false;
  510. ranked9 = true;
  511. }
  512.  
  513. if (ranker_score >= 3000)
  514. {
  515. PlayerPrefs.SetInt("ranker_number", rank_number);
  516. rank_number = 9;
  517. currentRank = colonel;
  518. ranked9 = false;
  519. ranked10 = true;
  520. }
  521.  
  522. if (ranker_score >= 4750)
  523. {
  524. PlayerPrefs.SetInt("ranker_number", rank_number);
  525. rank_number = 10;
  526. currentRank = Brigader_general;
  527. ranked10 = false;
  528. ranked11 = true;
  529. }
  530.  
  531. if (ranker_score >= 6000)
  532. {
  533. PlayerPrefs.SetInt("ranker_number", rank_number);
  534. rank_number = 11;
  535. currentRank = maj_general;
  536. ranked11 = false;
  537. ranked12 = true;
  538. }
  539.  
  540. if (ranker_score >= 8500)
  541. {
  542. PlayerPrefs.SetInt("ranker_number", rank_number);
  543. rank_number = 12;
  544. currentRank = lt_general;
  545. ranked12 = false;
  546. ranked13 = true;
  547. }
  548.  
  549. if (ranker_score >= 10000)
  550. {
  551. PlayerPrefs.SetInt("ranker_number", rank_number);
  552. rank_number = 13;
  553. currentRank = lt_general;
  554. ranked13 = false;
  555. ranked14 = true;
  556. }
  557.  
  558. if (ranker_score >= 13500)
  559. {
  560. PlayerPrefs.SetInt("ranker_number", rank_number);
  561. rank_number = 14;
  562. currentRank = general;
  563. ranked14 = false;
  564. ranked15 = true;
  565. }
  566.  
  567. if (ranker_score >= 15500)
  568. {
  569. PlayerPrefs.SetInt("ranker_number", rank_number);
  570. rank_number = 15;
  571. currentRank = fivestargen;
  572. ranked15 = false;
  573. ranked16 = true;
  574. }
  575.  
  576. teamBPlayers.Count.ToString();
  577. Kongregate.Initialize();
  578. isPurchaseLoaded = false;
  579. totalCash = PlayerPrefs.GetInt("GP1");
  580. BMCash = 25000;
  581. LMACash = 0;
  582. totalXP = PlayerPrefs.GetInt("totalKill");
  583. challengeXP = PlayerPrefs.GetInt("cXP");
  584. recordedDeaths = PlayerPrefs.GetInt("totalDeath");
  585. PhotonNetwork.isMessageQueueRunning = true;
  586. photonView.viewID = 100;
  587. GameSettings.rc = this;
  588. GameSettings.menuOpened = true;
  589. leavingRoom = false;
  590. showScoreBoard = true;
  591. showOptions = false;
  592. eneteredBuySpot = false;
  593. eneteredBombSpot = false;
  594. showBuyMenu = false;
  595. currentAddingCashColor = addingColorFadeTo;
  596. currentTotalCashColor = GameSettings.HUDColor;
  597.  
  598. mc = GetComponent<MultiplayerChat>();
  599. os = GetComponent<OptionsSettings>();
  600. os.rc = this;
  601. sb = GetComponent<Scoreboard>();
  602. sb.rc = this;
  603. bm = GetComponent<BuyMenu>();
  604.  
  605. audioSource = GetComponent<AudioSource>();
  606. count = 0;
  607.  
  608. cameraMouseLook = welcomeCamera.GetComponent<FPSMouseLook>();
  609. cameraMouseLook.AssignTarget(null);
  610.  
  611. yield return new WaitForEndOfFrame();
  612.  
  613. //Set out initial properties
  614. Hashtable setPlayerProperties = new Hashtable();
  615. setPlayerProperties.Add("Score", (int)0);
  616. setPlayerProperties.Add("Kills", (int)0);
  617. setPlayerProperties.Add("Deaths", (int)0);
  618. setPlayerProperties.Add("Ping", (int)PhotonNetwork.GetPing());
  619. setPlayerProperties.Add("Team", (int)0); //0 = Spectators, 1 = teamA, 2 = teamB, 3 = Draw
  620. setPlayerProperties.Add("PlayerHP", (int)-1);
  621. PhotonNetwork.player.SetCustomProperties(setPlayerProperties);
  622. RefreshPlayerList();
  623. welcomeCameraTransform = welcomeCamera.transform;
  624. defaultCamPos = welcomeCameraTransform.position;
  625. defaultCamRot = welcomeCameraTransform.rotation;
  626.  
  627. timeleft = updateInterval;
  628.  
  629. yield return new WaitForEndOfFrame();
  630.  
  631.  
  632. //Set Room properties
  633. if (PhotonNetwork.isMasterClient)
  634. {
  635. referenceTime = (float)PhotonNetwork.time;
  636. currentGameStatus = 0;
  637.  
  638. Hashtable setRoomProperties = new Hashtable();
  639. setRoomProperties.Add("ReferenceTime", (float)PhotonNetwork.time);
  640. setRoomProperties.Add("GameStatus", (int)0); //0 = Play, 1 = team A won, 2 = team B won
  641. setRoomProperties.Add("TeamAScore", (int)0);
  642. setRoomProperties.Add("TeamBScore", (int)0);
  643. setRoomProperties.Add("bombTimer", (int)startTime);
  644. setRoomProperties.Add("bombPlatedTrue", (bool)bombPlanted);
  645. PhotonNetwork.room.SetCustomProperties(setRoomProperties);
  646. }
  647. else
  648. {
  649. referenceTime = (float)PhotonNetwork.room.customProperties["ReferenceTime"];
  650. currentGameStatus = (int)PhotonNetwork.room.customProperties["GameStatus"];
  651. }
  652. if (currentGameMode == "RUSH")
  653. {
  654. spawnHardPoint = GameObject.Find("HardPointSpawn");
  655. spawnHardPoint2 = GameObject.Find("HardPointSpawn2");
  656. spawnHardPoint3 = GameObject.Find("HardPointSpawn3");
  657. }
  658. if (currentGameMode == "RUSH")
  659. {
  660. createdHardpoint = false;
  661. //Added photonnetwork.ismasterclient 3/15/18
  662. if (createdHardpoint == false && PhotonNetwork.isMasterClient)
  663. {
  664. createdHardpoint = true;
  665. //PhotonNetwork.InstantiateSceneObject("Bomb Prefab (1)", spawnHardPoint.transform.position, spawnHardPoint.transform.rotation, 0, null);
  666. //PhotonNetwork.InstantiateSceneObject("Bomb Prefab (1)", spawnHardPoint2.transform.position, spawnHardPoint2.transform.rotation, 0, null);
  667. //PhotonNetwork.InstantiateSceneObject("Bomb Prefab (1)", spawnHardPoint3.transform.position, spawnHardPoint3.transform.rotation, 0, null);
  668. }
  669. if (createdHardpoint == true)
  670. {
  671.  
  672. }
  673. }
  674. yield return new WaitForEndOfFrame();
  675.  
  676. currentGameMode = (string)PhotonNetwork.room.customProperties["GameMode"];
  677. roundDuration = (float)PhotonNetwork.room.customProperties["RoundDuration"];
  678. GetTeamScores();
  679.  
  680. previousGameStatus = currentGameStatus;
  681.  
  682. //Used only for FFA mode
  683. if (PhotonNetwork.room.customProperties["KillLimit"] != null)
  684. {
  685. currentKillLimit = (int)PhotonNetwork.room.customProperties["KillLimit"];
  686. }
  687. else
  688. {
  689. currentKillLimit = 0;
  690. }
  691.  
  692. //Used only for ELM mode
  693. if (PhotonNetwork.room.customProperties["ScoreLimit"] != null)
  694. {
  695. currentScoreLimit = (int)PhotonNetwork.room.customProperties["ScoreLimit"];
  696. }
  697. else
  698. {
  699. currentScoreLimit = 0;
  700. }
  701.  
  702. if (PhotonNetwork.room.customProperties["WinningPlayer"] != null)
  703. {
  704. winningPlayer = (PhotonPlayer)PhotonNetwork.room.customProperties["WinningPlayer"];
  705. }
  706. else
  707. {
  708. winningPlayer = null;
  709. }
  710.  
  711. //Display notification that we joined room (locally)
  712. PostActivityRemote(PhotonNetwork.player.name + " joined", "", "", 0, 0);
  713. InvokeRepeating("RefreshPing", 3.5f, 3.5f);
  714.  
  715. GameSettings.currentGameMode = currentGameMode;
  716.  
  717.  
  718.  
  719. yield return new WaitForEndOfFrame();
  720.  
  721. doneSetup = true;
  722. }
  723.  
  724. public void GetTeamScores()
  725. {
  726. teamAScore = (int)PhotonNetwork.room.customProperties["TeamAScore"];
  727. teamBScore = (int)PhotonNetwork.room.customProperties["TeamBScore"];
  728. }
  729.  
  730. public void spawnAi()
  731. {
  732. //spawnPoints = GameObject.FindGameObjectsWithTag("spawn");
  733. if (botCount <= 34)
  734. {
  735. botCount++;
  736. InvokeRepeating("SpawnAi", 1, 3);
  737. ai1 = PhotonNetwork.Instantiate(Ais[Random.Range(0, Ais.Length)].name, spawnPoints[Random.Range(0, spawnPoints.Length)].transform.position, spawnPoint.rotation, 0) as GameObject;
  738. ai1.GetComponent<aiCon>().isMine = true;
  739. }
  740. PostActivityRemote("Zombie Bot" + Random.Range(1, 999).ToString() + " spawned", "", "", 0, 0);
  741. }
  742. //Added March 1st
  743. public void spawnAi1()
  744. {
  745. //spawnPoints = GameObject.FindGameObjectsWithTag("spawn1");
  746. if (botCount <= 34)
  747. {
  748. botCount++;
  749. InvokeRepeating("SpawnAi", 1, 3);
  750. ai1 = PhotonNetwork.Instantiate(Ais[Random.Range(0, Ais.Length)].name, spawnPoints[Random.Range(0, spawnPoints.Length)].transform.position, spawnPoint.rotation, 0) as GameObject;
  751. ai1.GetComponent<aiCon>().isMine = true;
  752. }
  753. PostActivityRemote("Marine Bot" + Random.Range(1, 999).ToString() + " spawned", "", "", 0, 0);
  754. }
  755.  
  756. void RefreshPlayerList()
  757. {
  758. PhotonPlayer[] playerList = PhotonNetwork.playerList;
  759.  
  760. teamAPlayers.Clear();
  761. teamBPlayers.Clear();
  762. spectatorNames = "";
  763.  
  764. for (int i = 0; i < playerList.Length; i++)
  765. {
  766. int playerTeamTmp = playerList[i].customProperties["Team"] != null ? (int)playerList[i].customProperties["Team"] : 0;
  767.  
  768. if (playerTeamTmp == 0 || playerTeamTmp < 1 || playerTeamTmp > 2)
  769. {
  770. if (spectatorNames != "")
  771. {
  772. spectatorNames += ", ";
  773. }
  774. spectatorNames += playerList[i].name;
  775. }
  776. else
  777. {
  778. if (playerTeamTmp == 1)
  779. {
  780. teamAPlayers.Add(playerList[i]);
  781. }
  782. else
  783. {
  784. teamBPlayers.Add(playerList[i]);
  785. }
  786. }
  787. }
  788.  
  789. teamAPlayers.Sort(SortPlayers);
  790. teamBPlayers.Sort(SortPlayers);
  791.  
  792. if (PhotonNetwork.player.customProperties["Team"] != null)
  793. {
  794. ourTeam = (int)PhotonNetwork.player.customProperties["Team"];
  795. GameSettings.ourTeam = ourTeam;
  796. }
  797. }
  798.  
  799. void RefreshPing()
  800. {
  801. Hashtable setPlayerProperties = new Hashtable();
  802. setPlayerProperties.Add("Ping", (int)PhotonNetwork.GetPing());
  803. PhotonNetwork.player.SetCustomProperties(setPlayerProperties);
  804. int Ping = (int)PhotonNetwork.player.customProperties["Ping"];
  805. if(Ping >= 1150) {
  806. Debug.Log("Player Kicked for High Ping!");
  807. PhotonNetwork.LeaveRoom();
  808. }
  809. }
  810.  
  811. public void ResetGameStatus(int statusIndex, PhotonPlayer wp)
  812. {
  813. referenceTime = (float)PhotonNetwork.time;
  814. Hashtable setRoomProperties = new Hashtable();
  815. setRoomProperties.Add("ReferenceTime", referenceTime);
  816. setRoomProperties.Add("bombTimer", (int)45);
  817. setRoomProperties.Add("GameStatus", statusIndex); //0 = Play, 1 = team A won, 2 = team B won, 3 = Draw
  818. if (statusIndex == 0)
  819. {
  820. setRoomProperties.Add("TeamAScore", (int)0);
  821. setRoomProperties.Add("TeamBScore", (int)0);
  822. }
  823. setRoomProperties.Add("WinningPlayer", wp); //Used only for FFA (Fre For All) mode to notify other the winning player
  824. PhotonNetwork.room.SetCustomProperties(setRoomProperties);
  825. }
  826.  
  827. void announcersound()
  828. {
  829. announcersfx.PlayOneShot(almostthere);
  830. }
  831.  
  832. void botSpawner()
  833. {
  834.  
  835. }
  836.  
  837. // Update is called once per frame
  838. void Update()
  839. {
  840. if(currentGameMode == "HOBH") {
  841. RenderSettings.skybox = darkSkybox;
  842. RenderSettings.fog = true;
  843. RenderSettings.fogDensity = 0.1F;
  844. RenderSettings.sun.gameObject.SetActive(false);
  845. }
  846.  
  847.  
  848. if (!doneSetup)
  849. return;
  850.  
  851. if (Input.GetKeyDown(KeyCode.Tab))
  852. {
  853. //Removing showScoreBoard = !showScoreBoard; to the line right below to remove scoreboard for Last Man Standing Players
  854. showScoreBoard = !showScoreBoard;
  855. showBuyMenu = false;
  856. showOptions = false;
  857. showPauseMenu = true;
  858. if (showScoreBoard && currentGameMode == "TDM")
  859. {
  860. RefreshPlayerList();
  861. }
  862. }
  863.  
  864.  
  865. os.enabled = showOptions;
  866. sb.enabled = showScoreBoard;
  867. bm.enabled = showBuyMenu;
  868.  
  869. if (!ourPlayer || timeToPurchase > 0)
  870. {
  871. if (Input.GetKeyDown(GameSettings.playerKeys[13]))
  872. {
  873. //print ("Buy menu key pressed");
  874. showBuyMenu = !showBuyMenu;
  875. showScoreBoard = false;
  876. showOptions = false;
  877. bm.buySection = BuyMenu.BuySection.Primary;
  878. }
  879.  
  880. }
  881.  
  882.  
  883.  
  884. //When some menu opened, block mouse views, walking, shooting etc.
  885. GameSettings.menuOpened = showScoreBoard || showBuyMenu || mc.chatState != MultiplayerChat.ChatState.None || showOptions;
  886.  
  887. Hashtable setPlayerProperties = new Hashtable();
  888. setPlayerProperties.Add("Rank", (int)rank_number);
  889. PhotonNetwork.player.SetCustomProperties(setPlayerProperties);
  890.  
  891.  
  892.  
  893. /*timeleft = updateInterval;
  894. accum += Time.timeScale / Time.deltaTime;
  895. ++frames;
  896.  
  897. // Interval ended - update GUI text and start new interval
  898. if (timeleft <= 0.0)
  899. {
  900. // display two fractional digits (f2 format)
  901. //fps = (accum/frames).ToString("f2") + "FPS";
  902. GameSettings.currentFPS = accum / frames;
  903. timeleft = updateInterval;
  904. accum = 0.0f;
  905. frames = 0;
  906. }*/
  907.  
  908. //Gradually reduce crosshair distance
  909. distance = Mathf.Lerp(distance, 5, Time.deltaTime * 10.5f);
  910.  
  911. //Lock cursor when needed
  912. //Added || Input.GetKeyDown(KeyCode.Tab) to if statement below at the end
  913. //showScoreBoard || showBuyMenu || showOptions || remove on below on
  914. if (showScoreBoard || showBuyMenu || showOptions || Input.GetKeyDown(KeyCode.Tab))
  915. {
  916. if (lockState != 0)
  917. {
  918. cursorLocked = false;
  919. lockState = 0;
  920. LockCursor(false);
  921. }
  922. }
  923. else
  924. {
  925. cursorLocked = true;
  926. if (lockState != 1)
  927. {
  928. cursorLocked = true;
  929. lockState = 1;
  930. LockCursor(true);
  931. }
  932. }
  933. }
  934.  
  935. IEnumerator Dome1Movein()
  936. {
  937. movesIn = 10;
  938. while(movesIn > 0)
  939. {
  940. movesIn--;
  941. dome1MoveTextActive = true;
  942. yield return new WaitForSeconds(2);
  943. dome1MoveTextActive = false;
  944. }
  945. }
  946.  
  947. IEnumerator Dome2Movein()
  948. {
  949. movesIn2 = 10;
  950. while (movesIn2 > 0)
  951. {
  952. movesIn2--;
  953. dome2MoveTextActive = true;
  954. yield return new WaitForSeconds(2);
  955. dome2MoveTextActive = false;
  956. }
  957. }
  958.  
  959. void LockCursor(bool lockCursor)
  960. {
  961. Cursor.lockState = lockCursor ? CursorLockMode.Locked : CursorLockMode.None;
  962. Cursor.visible = !lockCursor;
  963. }
  964.  
  965.  
  966. [PunRPC]
  967. void SetRank(int ranknum)
  968. {
  969. ranknum = cm6.rank_number;
  970. Debug.Log("Rank Number is " + ranknum.ToString());
  971. }
  972.  
  973.  
  974. void FixedUpdate()
  975. {
  976. if (!doneSetup)
  977. return;
  978.  
  979. if (actionReports.Count > 0)
  980. {
  981. for (int i = 0; i < actionReports.Count; i++)
  982. {
  983. if (actionReports[i].timer > 0)
  984. {
  985. actionReports[i].timer -= Time.deltaTime;
  986. }
  987. else
  988. {
  989. actionReports.RemoveAt(i);
  990. }
  991. }
  992. }
  993.  
  994.  
  995.  
  996. //Room logic, track round time
  997. if (currentGameStatus <= 0)
  998. {
  999.  
  1000. //currentRoundTime = roundDuration - Mathf.Round(((float)PhotonNetwork.time - referenceTime) * 10) / 10;
  1001.  
  1002. seconds = Mathf.FloorToInt(Mathf.CeilToInt(currentRoundTime) % 60);
  1003. minutes = Mathf.FloorToInt((Mathf.CeilToInt(currentRoundTime) / 60) % 60);
  1004. roundTimeString = string.Format("{0:00}:{1:00}", minutes, seconds);
  1005.  
  1006.  
  1007. if (currentGameMode == "FFA")
  1008. {
  1009. currentRoundTime = roundDuration - Mathf.Round(((float)PhotonNetwork.time - referenceTime) * 10) / 10;
  1010. }
  1011. if (currentGameMode == "BR")
  1012. {
  1013. currentRoundTime = roundDuration - Mathf.Round(((float)PhotonNetwork.time - referenceTime) * 10) / 10;
  1014. }
  1015.  
  1016. if (currentGameMode == "TDM")
  1017. {
  1018. currentRoundTime = roundDuration - Mathf.Round(((float)PhotonNetwork.time - referenceTime) * 10) / 10;
  1019. }
  1020. if (currentGameMode == "HOBH")
  1021. {
  1022. currentRoundTime = roundDuration - Mathf.Round(((float)PhotonNetwork.time - referenceTime) * 10) / 10;
  1023. }
  1024. if (currentGameMode == "RUSH")
  1025. {
  1026. currentRoundTime = roundDuration - Mathf.Round(((float)PhotonNetwork.time - referenceTime) * 10) / 10;
  1027. }
  1028.  
  1029. if (PhotonNetwork.isMasterClient)
  1030. {
  1031.  
  1032. if (currentRoundTime < 1 && PhotonNetwork.time > 0 && referenceTime > 0)
  1033. {
  1034. //Round time ended, check who won
  1035. int tmpGameState = 3;
  1036. PhotonPlayer tmpWinningPlayer = null;
  1037. currentRoundTime = 600;
  1038. if (currentGameMode == "TDM")
  1039. {
  1040. GetTeamScores();
  1041.  
  1042. if (teamAScore > teamBScore)
  1043. {
  1044. tmpGameState = 1;
  1045. }
  1046.  
  1047. if (teamBScore > teamAScore)
  1048. {
  1049. tmpGameState = 2;
  1050. }
  1051. }
  1052.  
  1053. if (currentGameMode == "RUSH")
  1054. {
  1055. GetTeamScores();
  1056.  
  1057. if (teamAScore > teamBScore)
  1058. {
  1059. tmpGameState = 1;
  1060. }
  1061.  
  1062. if (teamBScore > teamAScore)
  1063. {
  1064. tmpGameState = 2;
  1065. }
  1066. }
  1067.  
  1068. if (currentGameMode == "HOBH")
  1069. {
  1070. GetTeamScores();
  1071. if (teamAScore == teamBPlayers.Count)
  1072. {
  1073. tmpGameState = 1;
  1074. }
  1075.  
  1076. if (teamBScore == teamAPlayers.Count)
  1077. {
  1078. tmpGameState = 2;
  1079. }
  1080. }
  1081.  
  1082. if (currentGameMode == "FFA")
  1083. {
  1084. RefreshPlayerList();
  1085. tmpWinningPlayer = teamAPlayers.Count > 0 ? teamAPlayers[0] : null;
  1086. }
  1087.  
  1088. if (currentGameMode == "BR")
  1089. {
  1090. RefreshPlayerList();
  1091. tmpWinningPlayer = teamAPlayers.Count > 0 ? teamAPlayers[0] : null;
  1092. }
  1093.  
  1094.  
  1095.  
  1096. ResetGameStatus(tmpGameState, tmpWinningPlayer);
  1097. }
  1098. else
  1099. {
  1100. //Ensure that reference time always set
  1101. if (referenceTime < 1)
  1102. {
  1103. referenceTime = (float)PhotonNetwork.time;
  1104. Hashtable setRoomProperties = new Hashtable();
  1105. setRoomProperties.Add("ReferenceTime", referenceTime);
  1106. PhotonNetwork.room.SetCustomProperties(setRoomProperties);
  1107. print("Reference time missing, setting it again");
  1108. }
  1109. }
  1110. }
  1111. }
  1112. else
  1113. {
  1114. //Interval before next round
  1115. currentRoundTime = 10 - Mathf.Round(((float)PhotonNetwork.time - referenceTime) * 10) / 10;
  1116. roundTimeString = "00:00";
  1117. if (PhotonNetwork.isMasterClient)
  1118. {
  1119. if (currentRoundTime <= 0)
  1120. {
  1121. //Restart round
  1122. ResetGameStatus(currentGameStatus = 0, null);
  1123. }
  1124. if (currentRoundTime <= 0 && currentGameMode == "BR" && PhotonNetwork.playerList.Length == 1)
  1125. {
  1126. PhotonNetwork.LeaveRoom();
  1127. }
  1128. }
  1129. }
  1130.  
  1131.  
  1132.  
  1133. }
  1134.  
  1135.  
  1136.  
  1137. void OnGUI()
  1138. {
  1139. if (PhotonNetwork.room == null)
  1140. return;
  1141.  
  1142. GUI.skin = GameSettings.guiSkin;
  1143.  
  1144. /*if (ranked2 == true)
  1145. {
  1146. if (ranker_score < 15)
  1147. {
  1148. int currentxprank = ranker_score;
  1149. int nextRank = 15;
  1150. int ranksIn = currentxprank -= nextRank;
  1151. GUI.Label(new Rect(Screen.width / 2 - 80, Screen.height - 100, 400, 30), "Next rank in " + Mathf.Abs(ranksIn).ToString() + " Kills");
  1152. }
  1153. }
  1154. if (ranked3 == true)
  1155. {
  1156. if (ranker_score < 50)
  1157. {
  1158. int currentxprank = ranker_score;
  1159. int nextRank = 50;
  1160. int ranksIn = currentxprank -= nextRank;
  1161. GUI.Label(new Rect(Screen.width / 2 - 80, Screen.height - 100, 400, 30), "Next rank in " + Mathf.Abs(ranksIn).ToString() + " Kills");
  1162. }
  1163. }
  1164. if (ranked4 == true)
  1165. {
  1166. if (ranker_score < 100)
  1167. {
  1168. int currentxprank = ranker_score;
  1169. int nextRank = 100;
  1170. int ranksIn = currentxprank -= nextRank;
  1171. GUI.Label(new Rect(Screen.width / 2 - 80, Screen.height - 100, 400, 30), "Next rank in " + Mathf.Abs(ranksIn).ToString() + " Kills");
  1172. }
  1173. }
  1174. if (ranked5 == true)
  1175. {
  1176. if (ranker_score < 400)
  1177. {
  1178. int currentxprank = ranker_score;
  1179. int nextRank = 400;
  1180. int ranksIn = currentxprank -= nextRank;
  1181. GUI.Label(new Rect(Screen.width / 2 - 80, Screen.height - 100, 400, 30), "Next rank in " + Mathf.Abs(ranksIn).ToString() + " Kills");
  1182. }
  1183. }
  1184. if (ranked6 == true)
  1185. {
  1186. if (ranker_score < 600)
  1187. {
  1188. int currentxprank = ranker_score;
  1189. int nextRank = 600;
  1190. int ranksIn = currentxprank -= nextRank;
  1191. GUI.Label(new Rect(Screen.width / 2 - 80, Screen.height - 100, 400, 30), "Next rank in " + Mathf.Abs(ranksIn).ToString() + " Kills");
  1192. }
  1193. }
  1194. if (ranked7 == true)
  1195. {
  1196. if (ranker_score < 1000)
  1197. {
  1198. int currentxprank = ranker_score;
  1199. int nextRank = 1000;
  1200. int ranksIn = currentxprank -= nextRank;
  1201.  
  1202. GUI.Label(new Rect(Screen.width / 2 - 80, Screen.height - 100, 400, 30), "Next rank in " + Mathf.Abs(ranksIn).ToString() + " Kills");
  1203. }
  1204. }
  1205. if (ranked8 == true)
  1206. {
  1207. if (ranker_score < 1750)
  1208. {
  1209. int currentxprank = ranker_score;
  1210. int nextRank = 1750;
  1211. int ranksIn = currentxprank -= nextRank;
  1212. GUI.Label(new Rect(Screen.width / 2 - 80, Screen.height - 100, 400, 30), "Next rank in " + Mathf.Abs(ranksIn).ToString() + " Kills");
  1213. }
  1214. }
  1215. if (ranked9 == true)
  1216. {
  1217. if (ranker_score < 3000)
  1218. {
  1219. int currentxprank = ranker_score;
  1220. int nextRank = 3000;
  1221. int ranksIn = currentxprank -= nextRank;
  1222. GUI.color = GameSettings.textShadowColor;
  1223. GUI.Label(new Rect(Screen.width / 2 - 80, Screen.height - 100, 400, 30), "Next rank in " + Mathf.Abs(ranksIn).ToString() + " Kills");
  1224. }
  1225. }
  1226. if (ranked10 == true)
  1227. {
  1228. if (ranker_score < 4750)
  1229. {
  1230. int currentxprank = ranker_score;
  1231. int nextRank = 4750;
  1232. int ranksIn = currentxprank -= nextRank;
  1233. GUI.Label(new Rect(Screen.width / 2 - 80, Screen.height - 100, 400, 30), "Next rank in " + Mathf.Abs(ranksIn).ToString() + " Kills");
  1234. }
  1235. }
  1236. if (ranked11 == true)
  1237. {
  1238. if (ranker_score < 6000)
  1239. {
  1240. int currentxprank = ranker_score;
  1241. int nextRank = 6000;
  1242. int ranksIn = currentxprank -= nextRank;
  1243. GUI.Label(new Rect(Screen.width / 2 - 80, Screen.height - 100, 400, 30), "Next rank in " + Mathf.Abs(ranksIn).ToString() + " Kills");
  1244. }
  1245. }
  1246. if (ranked12 == true)
  1247. {
  1248. if (ranker_score < 8500)
  1249. {
  1250. int currentxprank = ranker_score;
  1251. int nextRank = 8500;
  1252. int ranksIn = currentxprank -= nextRank;
  1253. GUI.Label(new Rect(Screen.width / 2 - 80, Screen.height - 100, 400, 30), "Next rank in " + Mathf.Abs(ranksIn).ToString() + " Kills");
  1254. }
  1255. }
  1256. if (ranked13 == true)
  1257. {
  1258. if (ranker_score < 10000)
  1259. {
  1260. int currentxprank = ranker_score;
  1261. int nextRank = 10000;
  1262. int ranksIn = currentxprank -= nextRank;
  1263. GUI.Label(new Rect(Screen.width / 2 - 80, Screen.height - 100, 400, 30), "Next rank in " + Mathf.Abs(ranksIn).ToString() + " Kills");
  1264. }
  1265. }
  1266. if (ranked14 == true)
  1267. {
  1268. if (ranker_score < 13500)
  1269. {
  1270. int currentxprank = ranker_score;
  1271. int nextRank = 13500;
  1272. int ranksIn = currentxprank -= nextRank;
  1273. GUI.Label(new Rect(Screen.width / 2 - 80, Screen.height - 100, 400, 30), "Next rank in " + Mathf.Abs(ranksIn).ToString() + " Kills");
  1274. }
  1275. }
  1276. if (ranked15 == true)
  1277. {
  1278. if (ranker_score < 15500)
  1279. {
  1280. int currentxprank = ranker_score;
  1281. int nextRank = 15500;
  1282. int ranksIn = currentxprank -= nextRank;
  1283. GUI.Label(new Rect(Screen.width / 2 - 80, Screen.height - 100, 400, 30), "Next rank in " + Mathf.Abs(ranksIn).ToString() + " Kills");
  1284. }
  1285. }*/
  1286.  
  1287. if (currentGameMode == "BR" && spawnedPlayer)
  1288. {
  1289. GUI.color = GameSettings.textShadowColor;
  1290. GUI.Label(new Rect(5 + 1, 30 + 1, 250, 25), "Players Remaining " + teamAPlayers.Count.ToString() + " ");
  1291. GUI.color = GameSettings.HUDColor;
  1292. GUI.Label(new Rect(5, 30, 250, 25), "Players Remaining " + teamAPlayers.Count.ToString() + " ");
  1293. }
  1294.  
  1295. GUIStyle customHUD = new GUIStyle("label");
  1296. customHUD.fontSize = 28;
  1297. customLabel.fontSize = 25;
  1298. customLabel.normal.textColor = new Color(63, 91, 187);
  1299. //Custom Zombies Label commented to remove
  1300. //if (currentGameMode == "BM" && teamAPlayers.Count > 0)
  1301. //{
  1302. //GUI.Label(new Rect(Screen.width / 2 - 75, 50, 165, 150), botCount.ToString() + " Zombies", customLabel);
  1303. //}
  1304.  
  1305.  
  1306.  
  1307. if(currentGameMode == "DE")
  1308. {
  1309. customLayout1.normal.textColor = Color.red;
  1310. customLayout2.normal.textColor = Color.blue;
  1311. //GUI.Label(new Rect(175, 50, 150, 30), "Mercs Alive " + teamaplayersalive.ToString(), customLayout1);
  1312. //GUI.Label(new Rect(425, 50, 150, 30), "Marines Alive " + teambplayerslive.ToString(), customLayout2);
  1313. }
  1314.  
  1315. if (currentGameMode == "TDM"|| currentGameMode == "RUSH" || currentGameMode == "HOBH")
  1316. {
  1317. //GUI.DrawTexture(new Rect(-5, Screen.height - 116, 185, 22), ScoreHUDOVERLAYBG);
  1318. customLayout1.normal.textColor = Color.red;
  1319. customLayout2.normal.textColor = Color.blue;
  1320. customLayout1.fontSize = 30;
  1321. customLayout2.fontSize = 30;
  1322. //GUI.DrawTexture(new Rect(Screen.width / 2 - 0, 85, 150, 50), HUDOverlayBG);
  1323. GUI.Label(new Rect(25, Screen.height - 115, 175, 50), teamAScore.ToString(), customLayout1);
  1324. GUI.Label(new Rect(115, Screen.height - 115, 150, 50), teamBScore.ToString(), customLayout2);
  1325. }
  1326.  
  1327.  
  1328.  
  1329. if (showWeaponText == true)
  1330. {
  1331. GUI.color = Color.white;
  1332. GUI.Label(new Rect(Screen.width / 2 - 10 - distance, Screen.height / 2 - 1, 250, 100), "Switch Weapons Using 1/2/3");
  1333. }
  1334.  
  1335. if (showWeaponText == false)
  1336. {
  1337.  
  1338. }
  1339.  
  1340. if (dead == true)
  1341. {
  1342. this.StartCoroutine("confirmedKillTime");
  1343. GUI.DrawTexture(new Rect(Screen.width / 2 - 50, Screen.height / 2 - 50, 100, 100), confirmedkill);
  1344. GUI.DrawTexture(new Rect(Screen.width / 2 - 50, Screen.height / 2 - 25, 100, 100), scoreDisplay);
  1345.  
  1346. ranksforkill = PlayerPrefs.GetInt("totalKill");
  1347. if (ranksforkill == 15)
  1348. {
  1349. GUI.DrawTexture(new Rect(Screen.width / 2 - 35, Screen.height / 2 - 25, 100, 100), rank2);
  1350. rankupsfx.Play();
  1351. }
  1352.  
  1353.  
  1354. if (ranksforkill == 50)
  1355. {
  1356. GUI.DrawTexture(new Rect(Screen.width / 2 - 35, Screen.height / 2 - 25, 100, 100), rank4);
  1357. rankupsfx.Play();
  1358. }
  1359.  
  1360. if (ranksforkill == 100)
  1361. {
  1362. GUI.DrawTexture(new Rect(Screen.width / 2 - 35, Screen.height / 2 - 25, 100, 100), rank5);
  1363. rankupsfx.Play();
  1364. SteamUserStats.SetAchievement("100_Kills");
  1365. Debug.Log("We won! Achievement unlocked!");
  1366. }
  1367.  
  1368. if (ranksforkill == 400)
  1369. {
  1370. GUI.DrawTexture(new Rect(Screen.width / 2 - 35, Screen.height / 2 - 25, 100, 100), rank6);
  1371. rankupsfx.Play();
  1372. }
  1373.  
  1374. if (ranksforkill == 600)
  1375. {
  1376. GUI.DrawTexture(new Rect(Screen.width / 2 - 35, Screen.height / 2 - 25, 100, 100), rank7);
  1377. rankupsfx.Play();
  1378. SteamUserStats.SetAchievement("600_Kills");
  1379. Debug.Log("We won! Achievement unlocked!");
  1380. }
  1381.  
  1382. if (ranksforkill == 1000)
  1383. {
  1384. GUI.DrawTexture(new Rect(Screen.width / 2 - 35, Screen.height / 2 - 25, 100, 100), rank8);
  1385. rankupsfx.Play();
  1386. SteamUserStats.SetAchievement("1000_Kills");
  1387. Debug.Log("We won! Achievement unlocked!");
  1388. }
  1389.  
  1390. if (ranksforkill == 1750)
  1391. {
  1392. GUI.DrawTexture(new Rect(Screen.width / 2 - 35, Screen.height / 2 - 25, 100, 100), rank9);
  1393. rankupsfx.Play();
  1394. }
  1395.  
  1396. if (ranksforkill == 3000)
  1397. {
  1398. GUI.DrawTexture(new Rect(Screen.width / 2 - 35, Screen.height / 2 - 25, 100, 100), rank10);
  1399. rankupsfx.Play();
  1400. }
  1401.  
  1402. if (ranksforkill == 4750)
  1403. {
  1404. GUI.DrawTexture(new Rect(Screen.width / 2 - 35, Screen.height / 2 - 25, 100, 100), rank11);
  1405. rankupsfx.Play();
  1406. }
  1407.  
  1408. if (ranksforkill == 6000)
  1409. {
  1410. GUI.DrawTexture(new Rect(Screen.width / 2 - 35, Screen.height / 2 - 25, 100, 100), rank12);
  1411. rankupsfx.Play();
  1412. }
  1413.  
  1414. if (ranksforkill == 8500)
  1415. {
  1416. GUI.DrawTexture(new Rect(Screen.width / 2 - 35, Screen.height / 2 - 25, 100, 100), rank13);
  1417. rankupsfx.Play();
  1418. }
  1419.  
  1420. if (ranksforkill == 10000)
  1421. {
  1422. GUI.DrawTexture(new Rect(Screen.width / 2 - 35, Screen.height / 2 - 25, 100, 100), rank14);
  1423. rankupsfx.Play();
  1424. }
  1425.  
  1426. if (ranksforkill == 13500)
  1427. {
  1428. GUI.DrawTexture(new Rect(Screen.width / 2 - 35, Screen.height / 2 - 25, 100, 100), rank15);
  1429. rankupsfx.Play();
  1430. }
  1431.  
  1432. if (ranksforkill == 15500)
  1433. {
  1434. GUI.DrawTexture(new Rect(Screen.width / 2 - 35, Screen.height / 2 - 25, 100, 100), rank15);
  1435. rankupsfx.Play();
  1436. SteamUserStats.SetAchievement("MAX_OUT_1");
  1437. Debug.Log("We won! Achievement unlocked!");
  1438. }
  1439. }
  1440.  
  1441. if (dead == false)
  1442. {
  1443.  
  1444. }
  1445.  
  1446. if (leavingRoom)
  1447. {
  1448. GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), blackScreen);
  1449. }
  1450. else
  1451. {
  1452. if (ourPlayer && !ourPlayer.playerKilled)
  1453. {
  1454. //Show sniper scope
  1455. //if(scopeTexture && ourPlayer.playerWeapons.mainPlayerCamera && ourPlayer.playerWeapons.mainPlayerCamera.fieldOfView == GameSettings.sniperAimFOV){
  1456. if (scopeTexture != GameSettings.currentScopeTexture)
  1457. {
  1458. scopeTexture = GameSettings.currentScopeTexture;
  1459. if (scopeTexture != null)
  1460. {
  1461. scopeTextureRatio = (float)scopeTexture.width / (float)scopeTexture.height;
  1462. //print("scope texture height: " + scopeTexture.height.ToString());
  1463. }
  1464. }
  1465.  
  1466. if (scopeTexture != null)
  1467. {
  1468. GUI.DrawTexture(new Rect(Screen.width / 2 - (Screen.height * scopeTextureRatio) / 2, 0, Screen.height * scopeTextureRatio, Screen.height), scopeTexture, ScaleMode.StretchToFill);
  1469. }
  1470.  
  1471. //Crosshair, only show when not aiming
  1472. if (GameSettings.currentFOV == GameSettings.defaultFOV)
  1473. {
  1474. GUI.color = GameSettings.HUDColor;
  1475. GUI.DrawTexture(new Rect(Screen.width / 2 - 5 - distance, Screen.height / 2 - 1, 5, 1), whiteTexture);
  1476. GUI.DrawTexture(new Rect(Screen.width / 2 + distance, Screen.height / 2 - 1, 5, 1), whiteTexture);
  1477. GUI.DrawTexture(new Rect(Screen.width / 2 - 1, Screen.height / 2 - 5 - distance, 1, 5), whiteTexture);
  1478. GUI.DrawTexture(new Rect(Screen.width / 2 - 1, Screen.height / 2 + distance, 1, 5), whiteTexture);
  1479. }
  1480.  
  1481. if (GameSettings.currentFOV == GameSettings.defaultFOV && ourPlayer.playerWeapons.currentSelectedWeapon.wSettings.fireType == PlayerWeapons.FireType.Shotgun)
  1482. {
  1483. GUI.color = GameSettings.HUDColor;
  1484. GUI.DrawTexture(new Rect(Screen.width / 2 - 5 - distance, Screen.height / 2 - 1, 5, 1), shotgunTexture);
  1485. GUI.DrawTexture(new Rect(Screen.width / 2 + distance, Screen.height / 2 - 1, 5, 1), shotgunTexture);
  1486. GUI.DrawTexture(new Rect(Screen.width / 2 - 1, Screen.height / 2 - 5 - distance, 1, 5), shotgunTexture);
  1487. GUI.DrawTexture(new Rect(Screen.width / 2 - 1, Screen.height / 2 + distance, 1, 5), shotgunTexture);
  1488. }
  1489.  
  1490.  
  1491.  
  1492. if (ourPlayer.fpsController.movementState == 2)
  1493. {
  1494. GUI.DrawTexture(new Rect(105, Screen.height - 52, 42, 42), crouchGuy);
  1495.  
  1496. }
  1497. else if (ourPlayer.fpsController.movementState == 2)
  1498. {
  1499.  
  1500. }
  1501.  
  1502. //if ((int)PhotonNetwork.player.customProperties["PlayerHP"] <= 90)
  1503. //{
  1504. //this.StartCoroutine("RegenHealth");
  1505. //}
  1506.  
  1507.  
  1508. GUI.color = Color.white;
  1509. GUI.DrawTexture(new Rect(-5, Screen.height - 60, 118, 58), HUDOverlayBG);
  1510. GUI.Box(new Rect(10, Screen.height - 60, 100, 50), currentHP.ToString(), customHUD);
  1511. GUI.Label(new Rect(10, Screen.height - 60, 100, 50), currentHP.ToString(), customHUD);
  1512. if (currentHP > 50)
  1513. {
  1514. GUI.DrawTexture(new Rect(70, Screen.height - 55, 42, 42), HPVital);
  1515. }
  1516. //3/14/18
  1517. if (currentHP <= 50)
  1518. {
  1519. //healDone = false;
  1520. //this.StartCoroutine("RegenHealth");
  1521. GUI.DrawTexture(new Rect(70, Screen.height - 56, 42, 42), HPVitalRed);
  1522. }
  1523. if (ourPlayer.playerWeapons.currentSelectedWeapon)
  1524. {
  1525. GUI.DrawTexture(new Rect(Screen.width - 150, Screen.height - 60, 175, 50), HUDOverlayBG);
  1526. GUI.Label(new Rect(Screen.width - 145, Screen.height - 60, 175, 50),
  1527. ourPlayer.playerWeapons.currentSelectedWeapon.wSettings.bulletsPerClip.ToString() + " / " + ourPlayer.playerWeapons.currentSelectedWeapon.wSettings.reserveBullets.ToString() + " ",
  1528. customHUD);
  1529. }
  1530. }
  1531.  
  1532. if (doingHitDetector)
  1533. {
  1534. //Fade hit detectors
  1535. GUI.color = new Color(1, 0, 0, redScreenFade / 7);
  1536. GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), whiteTexture);
  1537. GUI.color = new Color(1, 1, 1, hitTopFade);
  1538. GUI.DrawTexture(new Rect(Screen.width / 2 - 64, Screen.height / 2 - 31 - hitDetectorsDistance, 128, 31), hitTop);
  1539. GUI.color = new Color(1, 1, 1, hitBottomFade);
  1540. GUI.DrawTexture(new Rect(Screen.width / 2 - 64, Screen.height / 2 + hitDetectorsDistance, 128, 31), hitBottom);
  1541. GUI.color = new Color(1, 1, 1, hitLeftFade);
  1542. GUI.DrawTexture(new Rect(Screen.width / 2 - 31 - hitDetectorsDistance, Screen.height / 2 - 64, 31, 128), hitLeft);
  1543. GUI.color = new Color(1, 1, 1, hitRightFade);
  1544. GUI.DrawTexture(new Rect(Screen.width / 2 + hitDetectorsDistance, Screen.height / 2 - 64, 31, 128), hitRight);
  1545. }
  1546.  
  1547. //Show timer
  1548. GUI.color = GameSettings.HUDColor;
  1549. GUI.Label(new Rect(Screen.width / 2 - 75, 10, 150, 50), roundTimeString, GameSettings.timeStyle);
  1550. GUI.DrawTexture(new Rect(Screen.width / 2 - 75, 10, 32, 32), clock);
  1551. //Show action reportsrespawn
  1552. for (int i = 0; i < actionReports.Count; i++)
  1553. {
  1554. Vector2 size1 = actionReports[i].leftText != "" ? GameSettings.actionReportStyle.CalcSize(new GUIContent(actionReports[i].middleText)) + new Vector2(5, 0) : Vector2.zero;
  1555. Vector2 size2 = actionReports[i].rightText != "" ? GameSettings.actionReportStyle.CalcSize(new GUIContent(actionReports[i].rightText)) + new Vector2(5, 0) : Vector2.zero;
  1556.  
  1557. GUI.color = GameSettings.textShadowColor;
  1558. GUI.Label(new Rect(Screen.width - size1.x - size2.x - 260 + 1, 10 + (i * 25) + 1, 250, 25), actionReports[i].leftText, GameSettings.actionReportStyle);
  1559. GUI.color = actionReports[i].leftTextColor;
  1560. GUI.Label(new Rect(Screen.width - size1.x - size2.x - 260, 10 + (i * 25), 250, 25), actionReports[i].leftText, GameSettings.actionReportStyle);
  1561.  
  1562. GUI.color = GameSettings.textShadowColor;
  1563. GUI.Label(new Rect(Screen.width - size2.x - 260 + 1, 10 + (i * 25) + 1, 250, 25), actionReports[i].middleText, GameSettings.actionReportWeaponStyle);
  1564. GUI.color = GameSettings.HUDColor;
  1565. GUI.Label(new Rect(Screen.width - size2.x - 260, 10 + (i * 25), 250, 25), actionReports[i].middleText, GameSettings.actionReportWeaponStyle);
  1566.  
  1567. GUI.color = GameSettings.textShadowColor;
  1568. GUI.Label(new Rect(Screen.width - 260 + 1, 10 + (i * 25) + 1, 250, 25), actionReports[i].rightText, GameSettings.actionReportStyle);
  1569. GUI.color = actionReports[i].rightTextColor;
  1570. GUI.Label(new Rect(Screen.width - 260, 10 + (i * 25), 250, 25), actionReports[i].rightText, GameSettings.actionReportStyle);
  1571. if (currentGameMode == "TDM")
  1572. {
  1573. //GUI.Label(new Rect(115, Screen.height - 60, 150, 50), (totalCash).ToString() + " GP", customHUD);
  1574. }
  1575. if (currentGameMode == "DE")
  1576. {
  1577. //GUI.Label(new Rect(115, Screen.height - 60, 150, 50), (totalCash).ToString() + " GP", customHUD);
  1578. }
  1579. if (currentGameMode == "RUSH")
  1580. {
  1581. //GUI.Label(new Rect(115, Screen.height - 60, 150, 50), (totalCash).ToString() + " GP", customHUD);
  1582. }
  1583. if (currentGameMode == "FFA")
  1584. {
  1585. //GUI.Label(new Rect(115, Screen.height - 60, 150, 50), (totalCash).ToString() + " GP", customHUD);
  1586. }
  1587. if (currentGameMode == "BR")
  1588. {
  1589. //GUI.Label(new Rect(115, Screen.height - 60, 150, 50), (LMACash).ToString() + " GP", customHUD);
  1590. }
  1591. if (currentGameMode == "BM")
  1592. {
  1593. //GUI.Label(new Rect(115, Screen.height - 60, 150, 50), (BMCash).ToString() + " GP", GameSettings.hudInfoStyle);
  1594. }
  1595. if (currentGameMode == "SR")
  1596. {
  1597. //GUI.Label(new Rect(115, Screen.height - 60, 150, 50), (SRCash).ToString() + " GP", GameSettings.hudInfoStyle);
  1598. }
  1599. }
  1600.  
  1601.  
  1602.  
  1603.  
  1604. //Show cash
  1605. GUI.color = currentAddingCashColor;
  1606. if (currentGameMode == "TDM" || currentGameMode == "FFA" || currentGameMode == "BR" || currentGameMode == "HOBH" || currentGameMode == "RUSH" || currentGameMode == "BM")
  1607. {
  1608. GUI.Label(new Rect(Screen.width / 2 - 5 - distance, Screen.height / 2 - 1, 150, 50), scoreToAddTmp, GameSettings.hudInfoStyle);
  1609. }
  1610.  
  1611. GUI.color = currentTotalCashColor;
  1612.  
  1613. GUI.color = GameSettings.HUDColor;
  1614. GUI.Label(new Rect(9, Screen.height - 175, 185, 50), "Press 'Tab' to pause");
  1615.  
  1616. GUI.color = GameSettings.HUDColor;
  1617.  
  1618. if (currentRespawnTime > -1 && currentGameMode != "BM")
  1619. {
  1620. GUI.color = GameSettings.textShadowColor;
  1621. GUI.Label(new Rect(5 + 1, 30 + 1, 250, 25), "Player spawns in " + currentRespawnTime.ToString() + " ");
  1622. GUI.color = GameSettings.HUDColor;
  1623. GUI.Label(new Rect(5, 30, 250, 25), "Player spawns in " + currentRespawnTime.ToString() + " ");
  1624. }
  1625.  
  1626.  
  1627.  
  1628. if (currentRespawnTime > -1 && spawnedPlayer == true && currentGameMode == "BM")
  1629. {
  1630. GUI.color = GameSettings.textShadowColor;
  1631. GUI.Label(new Rect(5 + 1, 30 + 1, 250, 25), "Player spawns in " + currentRespawnTime.ToString() + " ");
  1632. GUI.color = GameSettings.HUDColor;
  1633. GUI.Label(new Rect(5, 30, 250, 25), "Player spawns in " + currentRespawnTime.ToString() + " ");
  1634. }
  1635.  
  1636.  
  1637. if (TimeToStartGame > 0 && currentGameMode == "BR" && spawnedPlayer == true)
  1638. {
  1639. string textTmp = "Game Starts In: " + TimeToStartGame;
  1640. GUI.color = GameSettings.textShadowColor;
  1641. GUI.Label(new Rect(Screen.width / 2 - 200 + 1, Screen.height - 165 + 1, 400, 30), textTmp, GameSettings.keyPressStyle);
  1642. GUI.color = GameSettings.HUDColor;
  1643. GUI.Label(new Rect(Screen.width / 2 - 200, Screen.height - 165, 400, 30), textTmp, GameSettings.keyPressStyle);
  1644. }
  1645.  
  1646. if (startTime > 0 && currentGameMode == "RUSH" && bombPlanted == true)
  1647. {
  1648. string textTmp = "Bomb Detonates In: " + startTime;
  1649. GUI.color = GameSettings.textShadowColor;
  1650. GUI.Label(new Rect(Screen.width / 2 - 200 + 1, Screen.height - 165 + 1, 400, 30), textTmp, GameSettings.keyPressStyle);
  1651. GUI.color = GameSettings.HUDColor;
  1652. GUI.Label(new Rect(Screen.width / 2 - 200, Screen.height - 165, 400, 30), textTmp, GameSettings.keyPressStyle);
  1653. }
  1654.  
  1655. if (eneteredBombSpot && currentGameMode == "RUSH" && ourTeam == 1 && bombPlanted == false)
  1656. {
  1657. GUI.color = GameSettings.textShadowColor;
  1658. GUI.Label(new Rect(Screen.width / 2 - 100 + 1, Screen.height / 2 + 150 + 1, 200, 30), "Press '" + GameSettings.playerKeys[14].ToString() + "' to arm bomb", GameSettings.keyPressStyle);
  1659. GUI.color = GameSettings.HUDColor;
  1660. GUI.Label(new Rect(Screen.width / 2 - 100, Screen.height / 2 + 150, 200, 30), "Press '" + GameSettings.playerKeys[14].ToString() + "' to arm bomb", GameSettings.keyPressStyle);
  1661. if (Input.GetKeyDown(GameSettings.playerKeys[14]) && ourTeam == 1)
  1662. {
  1663. PhotonView photonView = PhotonView.Get(this);
  1664. photonView.RPC("Clock", PhotonTargets.All, startTime);
  1665. }
  1666. }
  1667.  
  1668. if (currentGameMode == "INF" && ourTeam == 1 && infectTime > 0)
  1669. {
  1670. GUI.color = GameSettings.textShadowColor;
  1671. GUI.Label(new Rect(Screen.width / 2 - 100 + 1, Screen.height / 2 + 150 + 1, 200, 30), "Alpha Zombie In: " + infectTime.ToString(), GameSettings.keyPressStyle);
  1672. GUI.color = GameSettings.HUDColor;
  1673. GUI.Label(new Rect(Screen.width / 2 - 100, Screen.height / 2 + 150, 200, 30), "Alpha Zombie In: " + infectTime.ToString(), GameSettings.keyPressStyle);
  1674. PhotonView photonView = PhotonView.Get(this);
  1675. photonView.RPC("StartInf", PhotonTargets.All, infectTime);
  1676. }
  1677.  
  1678. if (eneteredBombSpot && currentGameMode == "RUSH" && ourTeam == 2 && bombPlanted == true)
  1679. {
  1680. GUI.color = GameSettings.textShadowColor;
  1681. GUI.Label(new Rect(Screen.width / 2 - 100 + 1, Screen.height / 2 + 150 + 1, 200, 30), "Press '" + GameSettings.playerKeys[14].ToString() + "' to defuse bomb", GameSettings.keyPressStyle);
  1682. GUI.color = GameSettings.HUDColor;
  1683. GUI.Label(new Rect(Screen.width / 2 - 100, Screen.height / 2 + 150, 200, 30), "Press '" + GameSettings.playerKeys[14].ToString() + "' to defuse bomb", GameSettings.keyPressStyle);
  1684. if (Input.GetKey(GameSettings.playerKeys[14]) && ourTeam == 2)
  1685. {
  1686. Hashtable setRoomProperties = new Hashtable();
  1687. bombPlanted = false;
  1688. PhotonView photonView = PhotonView.Get(this);
  1689. photonView.RPC("ClockStop", PhotonTargets.All, startTime);
  1690. //StopCoroutine("TickCoroutine");
  1691. rankupsfx.Stop();
  1692. rankupsfx.PlayOneShot(firstBlood);
  1693. setRoomProperties.Add("TeamBScore", teamBScore);
  1694. teamBScore++;
  1695. startTime = 45;
  1696. }
  1697. }
  1698.  
  1699. if (eneteredBuySpot && currentGameMode == "BM")
  1700. {
  1701. if (Input.GetKeyDown(GameSettings.playerKeys[13]))
  1702. {
  1703. showBuyMenu = true;
  1704. }
  1705. GUI.color = GameSettings.textShadowColor;
  1706. GUI.Label(new Rect(Screen.width / 2 - 100 + 1, Screen.height / 2 + 150 + 1, 200, 30), "Press '" + GameSettings.playerKeys[13].ToString() + "' to open Buy Menu", GameSettings.keyPressStyle);
  1707. GUI.color = GameSettings.HUDColor;
  1708. GUI.Label(new Rect(Screen.width / 2 - 100, Screen.height / 2 + 150, 200, 30), "Press '" + GameSettings.playerKeys[13].ToString() + "' to open Buy Menu", GameSettings.keyPressStyle);
  1709. }
  1710.  
  1711. if (!ourPlayer || timeToPurchase > 0 && currentGameMode == "TDM")
  1712. {
  1713. string textTmp = "Press '" + GameSettings.playerKeys[13].ToString() + "' to open Buy Menu";
  1714. textTmp += timeToPurchase > 0 && ourPlayer ? " - " + timeToPurchase.ToString() + " seconds left" : "";
  1715.  
  1716. GUI.color = GameSettings.textShadowColor;
  1717. GUI.Label(new Rect(Screen.width / 2 - 200 + 1, Screen.height - 135 + 1, 400, 30), textTmp, GameSettings.keyPressStyle);
  1718. GUI.color = GameSettings.HUDColor;
  1719. GUI.Label(new Rect(Screen.width / 2 - 200, Screen.height - 135, 400, 30), textTmp, GameSettings.keyPressStyle);
  1720. }
  1721.  
  1722. if (!ourPlayer || timeToPurchase > 0 && currentGameMode == "RUSH")
  1723. {
  1724. string textTmp = "Press '" + GameSettings.playerKeys[13].ToString() + "' to open Buy Menu";
  1725. textTmp += timeToPurchase > 0 && ourPlayer ? " - " + timeToPurchase.ToString() + " seconds left" : "";
  1726.  
  1727. GUI.color = GameSettings.textShadowColor;
  1728. GUI.Label(new Rect(Screen.width / 2 - 200 + 1, Screen.height - 135 + 1, 400, 30), textTmp, GameSettings.keyPressStyle);
  1729. GUI.color = GameSettings.HUDColor;
  1730. GUI.Label(new Rect(Screen.width / 2 - 200, Screen.height - 135, 400, 30), textTmp, GameSettings.keyPressStyle);
  1731. }
  1732.  
  1733. if (!ourPlayer || timeToPurchase > 0 && currentGameMode == "BM")
  1734. {
  1735. string textTmp = "Press '" + GameSettings.playerKeys[13].ToString() + "' to open Buy Menu";
  1736. textTmp += timeToPurchase > 0 && ourPlayer ? " - " + timeToPurchase.ToString() + " seconds left" : "";
  1737.  
  1738. GUI.color = GameSettings.textShadowColor;
  1739. GUI.Label(new Rect(Screen.width / 2 - 200 + 1, Screen.height - 135 + 1, 400, 30), textTmp, GameSettings.keyPressStyle);
  1740. GUI.color = GameSettings.HUDColor;
  1741. GUI.Label(new Rect(Screen.width / 2 - 200, Screen.height - 135, 400, 30), textTmp, GameSettings.keyPressStyle);
  1742. }
  1743.  
  1744. if (!ourPlayer || timeToPurchase > 0 && currentGameMode == "BR")
  1745. {
  1746. string textTmp = "Press '" + GameSettings.playerKeys[13].ToString() + "' to open Buy Menu";
  1747. textTmp += timeToPurchase > 0 && ourPlayer ? " - " + timeToPurchase.ToString() + " seconds left" : "";
  1748.  
  1749. GUI.color = GameSettings.textShadowColor;
  1750. GUI.Label(new Rect(Screen.width / 2 - 200 + 1, Screen.height - 135 + 1, 400, 30), textTmp, GameSettings.keyPressStyle);
  1751. GUI.color = GameSettings.HUDColor;
  1752. GUI.Label(new Rect(Screen.width / 2 - 200, Screen.height - 135, 400, 30), textTmp, GameSettings.keyPressStyle);
  1753. }
  1754.  
  1755. if(dome1MoveTextActive == true)
  1756. {
  1757. string textTmp = "Play Area Moves In 10 Seconds";
  1758. GUI.color = GameSettings.textShadowColor;
  1759. GUI.Label(new Rect(Screen.width / 2 - 200 + 1, Screen.height - 190 + 1, 400, 30), textTmp, GameSettings.keyPressStyle);
  1760. GUI.color = GameSettings.HUDColor;
  1761. GUI.Label(new Rect(Screen.width / 2 - 200, Screen.height - 190, 400, 30), textTmp, GameSettings.keyPressStyle);
  1762. }
  1763.  
  1764. if (dome2MoveTextActive == true)
  1765. {
  1766. string textTmp = "Play Area Moves In 10 Seconds";
  1767. GUI.color = GameSettings.textShadowColor;
  1768. GUI.Label(new Rect(Screen.width / 2 - 200 + 1, Screen.height - 190 + 1, 400, 30), textTmp, GameSettings.keyPressStyle);
  1769. GUI.color = GameSettings.HUDColor;
  1770. GUI.Label(new Rect(Screen.width / 2 - 200, Screen.height - 190, 400, 30), textTmp, GameSettings.keyPressStyle);
  1771. }
  1772.  
  1773. if (!ourPlayer || timeToPurchase > 0 && currentGameMode == "SR")
  1774. {
  1775. string textTmp = "Press '" + GameSettings.playerKeys[13].ToString() + "' to open Buy Menu";
  1776.  
  1777. GUI.color = GameSettings.textShadowColor;
  1778. GUI.Label(new Rect(Screen.width / 2 - 200 + 1, Screen.height - 135 + 1, 400, 30), textTmp, GameSettings.keyPressStyle);
  1779. GUI.color = GameSettings.HUDColor;
  1780. GUI.Label(new Rect(Screen.width / 2 - 200, Screen.height - 135, 400, 30), textTmp, GameSettings.keyPressStyle);
  1781. }
  1782.  
  1783. GUI.color = Color.white;
  1784.  
  1785.  
  1786.  
  1787. //Show final screen
  1788. if (currentGameMode == "TDM")
  1789. {
  1790. if (currentGameStatus == 1)
  1791. {
  1792. GUI.color = GameSettings.teamAColor;
  1793. GUI.Label(new Rect(Screen.width / 2 - 175, Screen.height / 2 - 35, 350, 70), GameSettings.teamAName + " Won\n\n" + ((int)currentRoundTime).ToString(), GameSettings.finalScreenStyle);
  1794. }
  1795.  
  1796. if (currentGameStatus == 2)
  1797. {
  1798. GUI.color = GameSettings.teamBColor;
  1799. GUI.Label(new Rect(Screen.width / 2 - 175, Screen.height / 2 - 35, 350, 70), GameSettings.teamBName + " Won\n\n" + ((int)currentRoundTime).ToString(), GameSettings.finalScreenStyle);
  1800. }
  1801.  
  1802. if (currentGameStatus == 3)
  1803. {
  1804. GUI.color = GameSettings.drawColor;
  1805. GUI.Label(new Rect(Screen.width / 2 - 175, Screen.height / 2 - 35, 350, 70), "Draw\n\n" + ((int)currentRoundTime).ToString(), GameSettings.finalScreenStyle);
  1806. }
  1807. }
  1808.  
  1809. if (currentGameMode == "FFA")
  1810. {
  1811. if (currentGameStatus == 3)
  1812. {
  1813. GUI.color = winningPlayer == null ? GameSettings.drawColor : GameSettings.teamAColor;
  1814. GUI.Label(new Rect(Screen.width / 2 - 175, Screen.height / 2 - 35, 350, 70), (winningPlayer == null ? "No winning player" : winningPlayer.name + " Won") + "\n\n" + ((int)currentRoundTime).ToString(), GameSettings.finalScreenStyle);
  1815. }
  1816. }
  1817.  
  1818. if (currentGameMode == "BR")
  1819. {
  1820. if (currentGameStatus == 3)
  1821. {
  1822. GUI.color = winningPlayer == null ? GameSettings.drawColor : GameSettings.teamAColor;
  1823. GUI.Label(new Rect(Screen.width / 2 - 175, Screen.height / 2 - 35, 350, 70), (winningPlayer == null ? "No winning player" : winningPlayer.name + " Won") + "\n\n" + ((int)currentRoundTime).ToString(), GameSettings.finalScreenStyle);
  1824. }
  1825. }
  1826.  
  1827. if (currentGameMode == "RUSH")
  1828. {
  1829. if (currentGameStatus == 1)
  1830. {
  1831. GUI.color = GameSettings.teamAColor;
  1832. GUI.Label(new Rect(Screen.width / 2 - 175, Screen.height / 2 - 35, 350, 70), GameSettings.teamAName + " Won\n\n" + ((int)currentRoundTime).ToString(), GameSettings.finalScreenStyle);
  1833. }
  1834.  
  1835. if (currentGameStatus == 2)
  1836. {
  1837. GUI.color = GameSettings.teamBColor;
  1838. GUI.Label(new Rect(Screen.width / 2 - 175, Screen.height / 2 - 35, 350, 70), GameSettings.teamBName + " Won\n\n" + ((int)currentRoundTime).ToString(), GameSettings.finalScreenStyle);
  1839. }
  1840.  
  1841. if (currentGameStatus == 3)
  1842. {
  1843. GUI.color = GameSettings.drawColor;
  1844. GUI.Label(new Rect(Screen.width / 2 - 175, Screen.height / 2 - 35, 350, 70), "Draw\n\n" + ((int)currentRoundTime).ToString(), GameSettings.finalScreenStyle);
  1845. }
  1846. }
  1847.  
  1848. if (currentGameMode == "HOBH")
  1849. {
  1850. if (currentGameStatus == 1)
  1851. {
  1852. GUI.color = GameSettings.teamAColor;
  1853. GUI.Label(new Rect(Screen.width / 2 - 175, Screen.height / 2 - 35, 350, 70), GameSettings.teamAName + " Won\n\n" + ((int)currentRoundTime).ToString(), GameSettings.finalScreenStyle);
  1854. }
  1855.  
  1856. if (currentGameStatus == 2)
  1857. {
  1858. GUI.color = GameSettings.teamBColor;
  1859. GUI.Label(new Rect(Screen.width / 2 - 175, Screen.height / 2 - 35, 350, 70), GameSettings.teamBName + " Won\n\n" + ((int)currentRoundTime).ToString(), GameSettings.finalScreenStyle);
  1860. }
  1861.  
  1862. if (currentGameStatus == 3)
  1863. {
  1864. GUI.color = GameSettings.drawColor;
  1865. GUI.Label(new Rect(Screen.width / 2 - 175, Screen.height / 2 - 35, 350, 70), "Draw\n\n" + ((int)currentRoundTime).ToString(), GameSettings.finalScreenStyle);
  1866. }
  1867. }
  1868.  
  1869. if (currentGameMode == "BM")
  1870. {
  1871. if (currentGameStatus == 1)
  1872. {
  1873. GUI.color = GameSettings.teamBColor;
  1874. GUI.Label(new Rect(Screen.width / 2 - 175, Screen.height / 2 - 35, 350, 70), GameSettings.teamCName + " Won\n\n" + ((int)currentRoundTime).ToString(), GameSettings.finalScreenStyle);
  1875. }
  1876.  
  1877. if (currentGameStatus == 2)
  1878. {
  1879. GUI.color = GameSettings.teamAColor;
  1880. GUI.Label(new Rect(Screen.width / 2 - 175, Screen.height / 2 - 35, 350, 70), GameSettings.teamAName + " Won\n\n" + ((int)currentRoundTime).ToString(), GameSettings.finalScreenStyle);
  1881. }
  1882.  
  1883. if (currentGameStatus == 3)
  1884. {
  1885. GUI.color = GameSettings.drawColor;
  1886. GUI.Label(new Rect(Screen.width / 2 - 175, Screen.height / 2 - 35, 350, 70), "Survivors Win\n\n" + ((int)currentRoundTime).ToString(), GameSettings.finalScreenStyle);
  1887. }
  1888. }
  1889.  
  1890.  
  1891.  
  1892. GUIStyle customButton = new GUIStyle("button");
  1893. customButton.fontSize = 14;
  1894. //SHow fullscreen button
  1895. if (showScoreBoard || showOptions /*|| showBuyMenu*/)
  1896. {
  1897. GUI.color = Color.white;
  1898. if (GUI.Button(new Rect(Screen.width - 105, 5, 100, 20), "Fullscreen", customButton))
  1899. {
  1900. os.SetFullscreen();
  1901. }
  1902. }
  1903.  
  1904. //SHow Add CASH button
  1905. if (showBuyMenu || showOptions /*|| showBuyMenu*/)
  1906. {
  1907. GUI.color = Color.white;
  1908. }
  1909. }
  1910. }
  1911.  
  1912. /*void startBomb()
  1913. {
  1914. this.StartCoroutine("TickCoroutine");
  1915. }*/
  1916.  
  1917. [PunRPC]
  1918. void Clock(int timer)
  1919. {
  1920. this.StartCoroutine("TickCoroutine");
  1921. bombPlanted = true;
  1922. rankupsfx.Play();
  1923. rankupsfx.loop = true;
  1924. Debug.Log("Timer is at " + timer + bombPlanted.ToString());
  1925. }
  1926.  
  1927. [PunRPC]
  1928. void ClockStop(int timer)
  1929. {
  1930. this.StopCoroutine("TickCoroutine");
  1931. bombPlanted = false;
  1932. timer = 45;
  1933. startTime = 45;
  1934. rankupsfx.Stop();
  1935. Debug.Log("Timer is at " + timer + bombPlanted.ToString());
  1936. }
  1937.  
  1938. [PunRPC]
  1939. void StartInf(int timer)
  1940. {
  1941. this.StartCoroutine("firstInfected");
  1942. rankupsfx.Play();
  1943. rankupsfx.loop = true;
  1944. Debug.Log("Infect Timer is at " + timer);
  1945. }
  1946.  
  1947. IEnumerator TickCoroutine()
  1948. {
  1949. Bomb = GameObject.Find("BuySpot(Clone)");
  1950. explosion = Bomb.transform.Find("explosion");
  1951. Hashtable setRoomProperties = new Hashtable();
  1952. int currentTeamScore = 0;
  1953. //startTime = 124;
  1954. while (startTime > 1)
  1955. {
  1956. startTime-=1;
  1957. yield return new WaitForSeconds(1);
  1958. //rankupsfx.loop = true;
  1959. if (startTime == 1)
  1960. {
  1961. explosion.gameObject.SetActive(true);
  1962. yield return new WaitForSeconds(2);
  1963. Destroy(Bomb);
  1964. bombPlanted = false;
  1965. startTime = 0;
  1966. teamAScore++;
  1967. setRoomProperties.Add("TeamAScore", teamAScore);
  1968. }
  1969. }
  1970. }
  1971.  
  1972. //SPAWN PLAYER CONTROLLER ###############################################################################################################################################
  1973. public void PrepareRespawn(int team, bool wasSwitched)
  1974. {
  1975.  
  1976. if (wasSwitched)
  1977. {
  1978. showScoreBoard = false;
  1979. showBuyMenu = false;
  1980. showOptions = false;
  1981. }
  1982. else
  1983. {
  1984.  
  1985. }
  1986.  
  1987. if (team < 0)
  1988. {
  1989. team = Mathf.Abs(team);
  1990. Transform targetTmp = null;
  1991.  
  1992. //print ("Killer ID: " + team.ToString());
  1993.  
  1994. //Clear empty slots
  1995. for (int i = otherPlayers.Count - 1; i >= 0; i--)
  1996. {
  1997. if (otherPlayers[i] == null)
  1998. {
  1999. otherPlayers.RemoveAt(i);
  2000. }
  2001. else
  2002. {
  2003. if (otherPlayers[i].playerID == team)
  2004. {
  2005. targetTmp = otherPlayers[i].playerAudio.transform;
  2006. //print ("Target player ID: " + otherPlayers[i].playerID.ToString());
  2007. }
  2008. }
  2009. }
  2010.  
  2011. if (ourPlayer)
  2012. {
  2013. welcomeCameraTransform.position = ourPlayer.thisT.position;
  2014. if (targetTmp == null)
  2015. {
  2016. targetTmp = ourPlayer.playerAudio.transform;
  2017. }
  2018. }
  2019.  
  2020. welcomeCamera.gameObject.SetActive(true);
  2021. cameraMouseLook.AssignTarget(targetTmp);
  2022.  
  2023. }
  2024. else
  2025. {
  2026. if (ourPlayer)
  2027. {
  2028. PhotonNetwork.Destroy(ourPlayer.gameObject);
  2029. }
  2030.  
  2031. welcomeCamera.transform.position = defaultCamPos;
  2032. welcomeCamera.transform.rotation = defaultCamRot;
  2033. welcomeCamera.gameObject.SetActive(true);
  2034.  
  2035. Hashtable setPlayerProperties = new Hashtable();
  2036. setPlayerProperties.Add("Team", team); //0 = Spectators, 1 = teamA, 2 = teamB
  2037. setPlayerProperties.Add("PlayerHP", (int)-1);
  2038. PhotonNetwork.player.SetCustomProperties(setPlayerProperties);
  2039. }
  2040. if (currentGameMode == "BM" && ourTeam == 1)
  2041. {
  2042. this.StartCoroutine("PrepareRespawnCoroutine");
  2043. playerSpawnZE = true;
  2044. }
  2045.  
  2046. if (currentGameMode == "SR" && ourTeam == 1)
  2047. {
  2048. this.StartCoroutine("PrepareRespawnCoroutine");
  2049. }
  2050.  
  2051. if (currentGameMode == "BM" && teamAPlayers.Count > 1)
  2052. {
  2053. //this.StartCoroutine("PrepareRespawnCoroutine");
  2054. }
  2055. if (currentGameStatus == 0 && currentGameMode == "TDM" || currentGameMode == "FFA" || currentGameMode == "BR" || currentGameMode == "RUSH" || currentGameMode == "HOBH" || currentGameMode == "BM")
  2056. {
  2057. //this.StopCoroutine("PrepareRespawnCoroutine");
  2058. this.StartCoroutine("PrepareRespawnCoroutine");
  2059. }
  2060.  
  2061. if(currentGameStatus == 0 && currentGameMode == "DE" && currentRoundTime < 110)
  2062. {
  2063. this.StartCoroutine("PrepareRespawnCoroutine");
  2064. }
  2065.  
  2066. if (wasSwitched)
  2067. {
  2068. JoinedTeam(team);
  2069. }
  2070.  
  2071. if (ourPlayer.playerKilled == true && currentGameMode == "TDM")
  2072. {
  2073. GetTeamScores();
  2074. recordedDeaths += 1;
  2075. PlayerPrefs.SetInt("totalDeath", recordedDeaths);
  2076. if (teamAScore == 75)
  2077. {
  2078. GetTeamScores();
  2079. currentGameStatus = 1;
  2080. ResetGameStatus(currentGameStatus, teamAPlayers[0]);
  2081. }
  2082.  
  2083. if (teamBScore == 75)
  2084. {
  2085. GetTeamScores();
  2086. currentGameStatus = 2;
  2087. ResetGameStatus(currentGameStatus, teamBPlayers[0]);
  2088. }
  2089. //Added March 1st
  2090. //PhotonNetwork.Destroy(ourPlayer.gameObject);
  2091. this.StartCoroutine("noSpawn");
  2092. }
  2093.  
  2094. if (ourPlayer.playerKilled == true && currentGameMode == "RUSH")
  2095. {
  2096. GetTeamScores();
  2097. recordedDeaths += 1;
  2098. PlayerPrefs.SetInt("totalDeath", recordedDeaths);
  2099. if (currentGameMode == "RUSH" && teamAScore == 1)
  2100. {
  2101. GetTeamScores();
  2102. currentGameStatus = 1;
  2103. ResetGameStatus(currentGameStatus, teamAPlayers[0]);
  2104. }
  2105. if(currentGameMode == "RUSH" && currentRoundTime < 1)
  2106. {
  2107. GetTeamScores();
  2108. currentGameStatus = 2;
  2109. ResetGameStatus(currentGameStatus, teamBPlayers[0]);
  2110. }
  2111. if (currentGameMode == "RUSH" && teamBScore >= 7500)
  2112. {
  2113. GetTeamScores();
  2114. currentGameStatus = 2;
  2115. ResetGameStatus(currentGameStatus, teamBPlayers[0]);
  2116. }
  2117. this.StartCoroutine("PrepareRespawnCoroutine");
  2118. }
  2119.  
  2120. if (ourPlayer.playerKilled == true && currentGameMode == "FFA")
  2121. {
  2122. if (teamAScore == 1)
  2123. {
  2124. announcersfx.PlayOneShot(firstBlood);
  2125. }
  2126. recordedDeaths += 1;
  2127. PlayerPrefs.SetInt("totalDeath", recordedDeaths);
  2128. this.StartCoroutine("noSpawn");
  2129. this.StopCoroutine("noSpawn");
  2130. }
  2131.  
  2132. if (ourPlayer.playerKilled == true && currentGameMode == "BR")
  2133. {
  2134. recordedDeaths += 1;
  2135. PlayerPrefs.SetInt("totalDeath", recordedDeaths);
  2136. this.StartCoroutine("PrepareRespawnCoroutine");
  2137. PhotonNetwork.LeaveRoom();
  2138. //lmadead = true;
  2139. }
  2140.  
  2141.  
  2142.  
  2143. if (ourPlayer.playerKilled == true && currentGameMode == "HOBH")
  2144. {
  2145. recordedDeaths += 1;
  2146. PlayerPrefs.SetInt("totalDeath", recordedDeaths);
  2147. this.StartCoroutine("LastManStandingCoroutine");
  2148. if (teamBScore == teamAPlayers.Count)
  2149. {
  2150. GetTeamScores();
  2151. currentGameStatus = 2;
  2152. ResetGameStatus(currentGameStatus, teamBPlayers[0]);
  2153. }
  2154. /*
  2155. if (teamAScore == teamBPlayers.Count)
  2156. {
  2157. GetTeamScores();
  2158. currentGameStatus = 1;
  2159. ResetGameStatus(currentGameStatus, teamAPlayers[0]);
  2160. }
  2161. */
  2162.  
  2163. }
  2164.  
  2165.  
  2166. }
  2167.  
  2168. IEnumerator noSpawn()
  2169. {
  2170. Hashtable setPlayerProperties = new Hashtable();
  2171. setPlayerProperties.Add("PlayerHP", (int)-1);
  2172. PhotonNetwork.player.SetCustomProperties(setPlayerProperties);
  2173. currentRespawnTime = 2;
  2174. //Added March 2nd
  2175. //if (ourPlayer)
  2176. //{
  2177. //ourPlayer.gameObject.SetActive(false);
  2178. //}
  2179. while (currentRespawnTime > 1)
  2180. {
  2181. yield return new WaitForSeconds(1);
  2182. if (currentRespawnTime < 0)
  2183. {
  2184. yield return new WaitForSeconds(1);
  2185.  
  2186. SpawnPlayer((int)PhotonNetwork.player.customProperties["Team"]);
  2187.  
  2188. }
  2189. }
  2190.  
  2191. if (currentGameMode == "SR")
  2192. {
  2193. if (currentRespawnTime < 1)
  2194. {
  2195. timeToPurchase = 1000;
  2196. }
  2197.  
  2198. }
  2199.  
  2200. }
  2201.  
  2202.  
  2203.  
  2204. IEnumerator confirmedKillTime()
  2205. {
  2206. expireKill = 2;
  2207.  
  2208. while (expireKill > 1)
  2209. {
  2210. expireKill--;
  2211. yield return new WaitForSeconds(1);
  2212. dead = false;
  2213. }
  2214. }
  2215.  
  2216.  
  2217. IEnumerator firstInfected()
  2218. {
  2219. infectTime = Random.Range(5, 15);
  2220.  
  2221. while (infectTime > 1)
  2222. {
  2223. infectTime--;
  2224. yield return new WaitForSeconds(1);
  2225. }
  2226. }
  2227.  
  2228.  
  2229. IEnumerator respawnInfected()
  2230. {
  2231.  
  2232. while (infectTime > 1)
  2233. {
  2234. infectTime--;
  2235. yield return new WaitForSeconds(1);
  2236. }
  2237. SpawnPlayer(1);
  2238. this.StopCoroutine("respawnInfected");
  2239. }
  2240. IEnumerator InitialprepareZombieBot()
  2241. {
  2242. int timeleft = 45;
  2243. while (timeleft > 1)
  2244. {
  2245. timeleft--;
  2246. yield return new WaitForSeconds(1);
  2247.  
  2248. }
  2249. //for (count = 0; count < 8; count++)
  2250. //spawnAi();
  2251. }
  2252. IEnumerator prepareZombieBot()
  2253. {
  2254. int timeleft = 2;
  2255. while (timeleft > 1)
  2256. {
  2257. timeleft--;
  2258. yield return new WaitForSeconds(1);
  2259. }
  2260.  
  2261. for (count = 0; count < 2; count++)
  2262. spawnAi();
  2263. }
  2264. IEnumerator PrepareRespawnCoroutine()
  2265. {
  2266. currentRespawnTime = 6;
  2267.  
  2268. while (currentRespawnTime > 1)
  2269. {
  2270. currentRespawnTime--;
  2271. yield return new WaitForSeconds(1);
  2272. }
  2273. SpawnPlayer((int)PhotonNetwork.player.customProperties["Team"]);
  2274. if (lmadead == true)
  2275. {
  2276. if (teamAPlayers.Count == 1)
  2277. {
  2278. Debug.Log("Game Is Over! " + teamAPlayers[0].ToString() + "Won!");
  2279. ResetGameStatus(1, teamAPlayers[0]);
  2280. }
  2281. }
  2282. Debug.Log("team A" + teamAPlayers.Count.ToString());
  2283. Debug.Log("team B" + teamBPlayers.Count.ToString());
  2284. if (currentGameMode == "BM")
  2285. {
  2286. SpawnPlayer(1);
  2287. StartCoroutine("InitialprepareZombieBot");
  2288. }
  2289. /*if (ourTeam == 1 && currentGameMode == "DE")
  2290. {
  2291. GetTeamScores();
  2292. }
  2293. if (ourTeam == 2 && currentGameMode == "DE")
  2294. {
  2295. GetTeamScores();
  2296. }
  2297. */
  2298. if (currentGameMode == "SR" && ourTeam == 1)
  2299. {
  2300. SpawnPlayer(1);
  2301. timeToPurchase = 1000;
  2302. }
  2303.  
  2304. }
  2305.  
  2306. public IEnumerator LastManStandingCoroutine()
  2307. {
  2308. currentRespawnTime = 120;
  2309. //LMADead = true;
  2310. while (currentRespawnTime > 1)
  2311. {
  2312. yield return new WaitForSeconds(1);
  2313. };
  2314. }
  2315.  
  2316. IEnumerator BattleRoyaleCoroutine()
  2317. {
  2318. currentRespawnTime = 1500;
  2319. while (currentRespawnTime > 1)
  2320. {
  2321. yield return new WaitForSeconds(1);
  2322. };
  2323. }
  2324.  
  2325.  
  2326.  
  2327. IEnumerator countDownClock()
  2328. {
  2329.  
  2330. TimeToStartGame = 1500;
  2331. TimeToStartGame -= 1445;
  2332. while (TimeToStartGame > -7)
  2333. {
  2334. TimeToStartGame--;
  2335. yield return new WaitForSeconds(1);
  2336. if(deployweapons == true)
  2337. {
  2338. ourPlayer.playerWeapons.currentSelectedWeapon.Deploy();
  2339. }
  2340. countingDown = false;
  2341. }
  2342. }
  2343.  
  2344. IEnumerator showWeaponInfo()
  2345. {
  2346. infoCount = 4;
  2347. while (infoCount > 0)
  2348. {
  2349. infoCount--;
  2350. showWeaponText = true;
  2351. yield return new WaitForSeconds(1);
  2352. showWeaponText = false;
  2353. infoCount = 0;
  2354. }
  2355. }
  2356.  
  2357. public void SpawnPlayer(int team)
  2358. {
  2359.  
  2360. if (ourPlayer)
  2361. {
  2362. PhotonNetwork.Destroy(ourPlayer.gameObject);
  2363. }
  2364. spawnedPlayer = true;
  2365. countingDown = true;
  2366. freeforallstart = true;
  2367. if(currentGameMode == "FFA" && freeforallstart == true)
  2368. {
  2369. announcersfx.PlayOneShot(ffaAudio);
  2370. freeforallstart = false;
  2371. }
  2372. if (currentGameMode == "BR" && spawnedPlayer == true)
  2373. {
  2374. this.StartCoroutine("countDownClock");
  2375. }
  2376. if (team == 1 || team == 2)
  2377. {
  2378.  
  2379. if (currentGameMode == "TDM")
  2380. {
  2381.  
  2382. spawnPontTmp = team == 1 ? teamASpawnPoints[Random.Range(0, teamASpawnPoints.Count - 1)] : teamBSpawnPoints[Random.Range(0, teamBSpawnPoints.Count - 1)];
  2383. }
  2384.  
  2385. if (currentGameMode == "RUSH")
  2386. {
  2387.  
  2388. spawnPontTmp = team == 1 ? teamASpawnPoints[Random.Range(0, teamASpawnPoints.Count - 1)] : teamBSpawnPoints[Random.Range(0, teamBSpawnPoints.Count - 1)];
  2389. }
  2390.  
  2391. if (currentGameMode == "HOBH")
  2392. {
  2393. spawnPontTmp = team == 1 ? teamASpawnPoints[Random.Range(0, teamASpawnPoints.Count - 1)] : teamBSpawnPoints[Random.Range(0, teamBSpawnPoints.Count - 1)];
  2394. spawnPoints = GameObject.FindGameObjectsWithTag("spawn");
  2395. }
  2396.  
  2397. if (currentGameMode == "BM")
  2398. {
  2399. spawnPontTmp = team == 1 ? teamASpawnPoints[Random.Range(0, teamASpawnPoints.Count - 1)] : teamBSpawnPoints[Random.Range(0, teamBSpawnPoints.Count - 1)];
  2400. }
  2401.  
  2402. if (currentGameMode == "SR")
  2403. {
  2404. spawnPontTmp = team == 1 ? teamASpawnPoints[Random.Range(0, teamASpawnPoints.Count - 1)] : teamBSpawnPoints[Random.Range(0, teamBSpawnPoints.Count - 1)];
  2405. }
  2406.  
  2407. if (currentGameMode == "FFA")
  2408. {
  2409. spawnPoints = GameObject.FindGameObjectsWithTag("spawn");
  2410. }
  2411.  
  2412. if (currentGameMode == "BR")
  2413. {
  2414. spawnPoints = GameObject.FindGameObjectsWithTag("brspawn");
  2415. }
  2416.  
  2417. if (currentGameMode == "TDM" || currentGameMode == "RUSH")
  2418. {
  2419. GameObject ourPlayerTmp = PhotonNetwork.Instantiate(playerPrefab.name, spawnPontTmp.position, spawnPontTmp.rotation, 0);
  2420. ourPlayer = ourPlayerTmp.GetComponent<PlayerNetwork>();
  2421. }
  2422. if(currentGameMode == "HOBH" && ourTeam == 1) {
  2423. GameObject ourPlayerTmp = PhotonNetwork.Instantiate(playerPrefab.name, spawnPontTmp.position, spawnPontTmp.rotation, 0);
  2424. ourPlayer = ourPlayerTmp.GetComponent<PlayerNetwork>();
  2425. }
  2426. if(currentGameMode == "HOBH" && ourTeam == 2) {
  2427. GameObject ourPlayerTmp = PhotonNetwork.Instantiate(playerPrefab2.name, spawnPoints[Random.Range(0, spawnPoints.Length)].transform.position, spawnPoint.rotation, 0);
  2428. ourPlayer = ourPlayerTmp.GetComponent<PlayerNetwork>();
  2429. }
  2430. else if (currentGameMode == "BM" || currentGameMode == "SR")
  2431. {
  2432. GameObject ourPlayerTmp = PhotonNetwork.Instantiate(playerPrefab.name, spawnPontTmp.position, spawnPontTmp.rotation, 0);
  2433. ourPlayer = ourPlayerTmp.GetComponent<PlayerNetwork>();
  2434. }
  2435. if(currentGameMode == "FFA" || currentGameMode == "BR")
  2436. {
  2437. GameObject ourPlayerTmp = PhotonNetwork.Instantiate(playerPrefab.name, spawnPoints[Random.Range(0, spawnPoints.Length)].transform.position, spawnPoint.rotation, 0);
  2438. ourPlayer = ourPlayerTmp.GetComponent<PlayerNetwork>();
  2439. }
  2440.  
  2441.  
  2442. bm.lastSelectedWeapon = 1;
  2443. bm.Invoke("ApplySelectedWeapons", 0.035f);
  2444.  
  2445. welcomeCamera.gameObject.SetActive(false);
  2446.  
  2447. this.StopCoroutine("PurchaseTimer");
  2448. this.StartCoroutine("PurchaseTimer");
  2449. }
  2450. else
  2451. {
  2452. welcomeCameraTransform.position = defaultCamPos;
  2453. welcomeCameraTransform.rotation = defaultCamRot;
  2454. welcomeCamera.gameObject.SetActive(true);
  2455. cameraMouseLook.AssignTarget(null);
  2456. team = 0;
  2457. }
  2458.  
  2459. if (PhotonNetwork.player.customProperties["Team"] == null || (int)PhotonNetwork.player.customProperties["Team"] != team)
  2460. {
  2461. Hashtable setPlayerProperties = new Hashtable();
  2462. setPlayerProperties.Add("Team", team); //0 = Spectators, 1 = teamA, 2 = teamB
  2463. PhotonNetwork.player.SetCustomProperties(setPlayerProperties);
  2464. }
  2465.  
  2466. currentRespawnTime = -1;
  2467.  
  2468.  
  2469.  
  2470.  
  2471.  
  2472. }
  2473.  
  2474.  
  2475.  
  2476. IEnumerator PurchaseTimer()
  2477. {
  2478. //Allow some time (in seconds) to allow newly spawned player purchase weapon)
  2479. timeToPurchase = 10;
  2480.  
  2481. while (timeToPurchase > 0)
  2482. {
  2483. timeToPurchase--;
  2484. yield return new WaitForSeconds(1);
  2485. }
  2486. }
  2487. //SPAWN PLAYER CONTROLLE REND ############################################################################################################################################
  2488.  
  2489. //PHOTON NETWORK CALLBACKS ############################################################################################################################################
  2490. void OnLeftRoom()
  2491. {
  2492. //Back to MainMenu scene
  2493. Application.LoadLevel("_WebGL_MaintMenu");
  2494. }
  2495.  
  2496. void OnPhotonPlayerPropertiesChanged(/*object[] playerAndUpdatedProps*/)
  2497. {
  2498. //PhotonPlayer player = playerAndUpdatedProps[0] as PhotonPlayer;
  2499. //Hashtable props = playerAndUpdatedProps[1] as Hashtable;
  2500.  
  2501. RefreshPlayerList();
  2502.  
  2503. if (PhotonNetwork.player.customProperties["PlayerHP"] != null)
  2504. {
  2505. currentHP = (int)PhotonNetwork.player.customProperties["PlayerHP"];
  2506. }
  2507.  
  2508. //print ("Round is already at: " + ((float)PhotonNetwork.time - referenceTime).ToString() + " seconds");
  2509.  
  2510. if (currentGameMode == "HOBH" && currentGameStatus == 0)
  2511. {
  2512. /*if ((int)teamAPlayers[0].customProperties["Kills"] >= teamBPlayers.Count)
  2513. {
  2514. currentGameStatus = 2;
  2515. ResetGameStatus(currentGameStatus, teamAPlayers[0]);
  2516. teamaplayersalive = teamAPlayers.Count;
  2517. teambplayerslive = teamBPlayers.Count;
  2518. }
  2519. */
  2520. if(teamAPlayers.Count > 0) {
  2521. if(teamBScore == (int)teamAPlayers.Count) {
  2522. currentGameStatus = 2;
  2523. ResetGameStatus(currentGameStatus, teamBPlayers[0]);
  2524. }
  2525. }
  2526. }
  2527.  
  2528. if (currentGameMode == "RUSH" && currentGameStatus == 0)
  2529. {
  2530. if ((int)teamAScore == 1)
  2531. {
  2532. currentGameStatus = 1;
  2533. ResetGameStatus(currentGameStatus, teamAPlayers[0]);
  2534. PhotonView photonView = PhotonView.Get(this);
  2535. photonView.RPC("ClockStop", PhotonTargets.All, startTime);
  2536. }
  2537. if(currentRoundTime < 1 && PhotonNetwork.time > 0 && referenceTime > 0)
  2538. {
  2539. if ((int)teamBScore == 1)
  2540. {
  2541. currentGameStatus = 2;
  2542. }
  2543. }
  2544. }
  2545.  
  2546. if (currentGameMode == "INF" && currentGameStatus == 0)
  2547. {
  2548. if ((int)teamBScore == teamAPlayers.Count)
  2549. {
  2550. currentGameStatus = 2;
  2551. ResetGameStatus(currentGameStatus, teamAPlayers[0]);
  2552. }
  2553. if(currentRoundTime < 1 && PhotonNetwork.time > 0 && referenceTime > 0)
  2554. {
  2555. currentGameStatus = 1;
  2556. }
  2557. }
  2558.  
  2559. if (currentGameMode == "FFA" && PhotonNetwork.isMasterClient && currentGameStatus == 0)
  2560. {
  2561. if (teamAPlayers.Count > 0 && (float)PhotonNetwork.time - referenceTime > 15)
  2562. {
  2563. if ((int)teamAPlayers[0].customProperties["Kills"] >= currentKillLimit)
  2564. {
  2565. int tmpGameState = 3;
  2566. ResetGameStatus(tmpGameState, teamAPlayers[0]);
  2567. }
  2568. }
  2569. }
  2570.  
  2571.  
  2572. /*if (currentGameMode == "BR" && PhotonNetwork.isMasterClient && currentGameStatus == 0)
  2573. {
  2574. if (teamAPlayers.Count > 0 && (float)PhotonNetwork.time - referenceTime > 15)
  2575. {
  2576. if ((int)teamAPlayers[0].customProperties["Kills"] >= currentKillLimit)
  2577. {
  2578. int tmpGameState = 3;
  2579. ResetGameStatus(tmpGameState, teamAPlayers[0]);
  2580. }
  2581. }
  2582. }*/
  2583.  
  2584.  
  2585. }
  2586.  
  2587. void OnPhotonPlayerConnected(PhotonPlayer newPlayer)
  2588. {
  2589. //Display notification that player connected
  2590. PostActivityRemote(newPlayer.name + " connected", "", "", 0, 0);
  2591. }
  2592.  
  2593. void OnPhotonPlayerDisconnected(PhotonPlayer otherPlayer)
  2594. {
  2595. RefreshPlayerList();
  2596.  
  2597. //Display notification that player disconnected
  2598. PostActivityRemote(otherPlayer.name + " disconnected", "", "", 0, 0);
  2599. }
  2600.  
  2601. void OnPhotonCustomRoomPropertiesChanged(/*Hashtable propertiesThatChanged*/)
  2602. {
  2603. GetTeamScores();
  2604. referenceTime = (float)PhotonNetwork.room.customProperties["ReferenceTime"];
  2605. currentGameStatus = (int)PhotonNetwork.room.customProperties["GameStatus"];
  2606. currentGameMode = (string)PhotonNetwork.room.customProperties["GameMode"];
  2607. startTime = (int)PhotonNetwork.room.customProperties["bombTimer"];
  2608. //Used only for FFA mode
  2609. if (PhotonNetwork.room.customProperties["KillLimit"] != null)
  2610. {
  2611. currentKillLimit = (int)PhotonNetwork.room.customProperties["KillLimit"];
  2612. }
  2613.  
  2614. if (PhotonNetwork.room.customProperties["bombTimer"] != null)
  2615. {
  2616. Debug.Log("Bomb Timer Set!");
  2617. startTime = (int)PhotonNetwork.room.customProperties["bombTimer"];
  2618. }
  2619.  
  2620. //Used only for ELM mode
  2621. if (PhotonNetwork.room.customProperties["ScoreLimit"] != null)
  2622. {
  2623. currentScoreLimit = (int)PhotonNetwork.room.customProperties["ScoreLimit"];
  2624. }
  2625.  
  2626. if (PhotonNetwork.room.customProperties["WinningPlayer"] != null)
  2627. {
  2628. winningPlayer = (PhotonPlayer)PhotonNetwork.room.customProperties["WinningPlayer"];
  2629. }
  2630. else
  2631. {
  2632. winningPlayer = null;
  2633. }
  2634.  
  2635. if (currentGameStatus == 1 || currentGameStatus == 2 || currentGameStatus == 3)
  2636. {
  2637. //Round ended
  2638. this.StopCoroutine("PrepareRespawnCoroutine");
  2639. if (previousGameStatus != currentGameStatus)
  2640. {
  2641. if (ourPlayer)
  2642. {
  2643. PhotonNetwork.Destroy(ourPlayer.gameObject);
  2644. }
  2645.  
  2646. welcomeCamera.transform.position = defaultCamPos;
  2647. welcomeCamera.transform.rotation = defaultCamRot;
  2648. welcomeCamera.gameObject.SetActive(true);
  2649.  
  2650. showScoreBoard = false;
  2651.  
  2652. if (winningPlayer != null && winningPlayer == PhotonNetwork.player)
  2653. {
  2654. //Wee won, add award
  2655. StartCoroutine(AddCashDelayed());
  2656. }
  2657.  
  2658. previousGameStatus = currentGameStatus;
  2659. }
  2660. }
  2661.  
  2662. //Round was restarted, reset Kills/Deaths and Spawn our player if needed
  2663. if (currentGameStatus == 0 && previousGameStatus != 0)
  2664. {
  2665. if (PhotonNetwork.isMasterClient)
  2666. {
  2667. //Reset kills and deaths for every player
  2668. StopCoroutine("ResetPlayersKillsDeaths");
  2669. StartCoroutine("ResetPlayersKillsDeaths");
  2670. }
  2671.  
  2672. //Recheck our team
  2673. if (PhotonNetwork.player.customProperties["Team"] != null)
  2674. {
  2675. ourTeam = (int)PhotonNetwork.player.customProperties["Team"];
  2676. GameSettings.ourTeam = ourTeam;
  2677. }
  2678.  
  2679. if (ourTeam == 1 || ourTeam == 2)
  2680. {
  2681. SpawnPlayer(ourTeam);
  2682. }
  2683.  
  2684.  
  2685. previousGameStatus = 0;
  2686. }
  2687. }
  2688.  
  2689. IEnumerator ResetPlayersKillsDeaths()
  2690. {
  2691. while (PhotonNetwork.playerList.Length == 0)
  2692. {
  2693. yield return null;
  2694. }
  2695.  
  2696. PhotonPlayer[] playersTmp = PhotonNetwork.playerList;
  2697.  
  2698. Hashtable setPlayerProperties = new Hashtable();
  2699. setPlayerProperties.Add("Kills", (int)0);
  2700. setPlayerProperties.Add("Deaths", (int)0);
  2701.  
  2702. for (int i = 0; i < playersTmp.Length; i++)
  2703. {
  2704. playersTmp[i].SetCustomProperties(setPlayerProperties);
  2705. }
  2706. }
  2707.  
  2708. IEnumerator AddCashDelayed()
  2709. {
  2710. yield return new WaitForSeconds(0.35f);
  2711. AddKillCash(-1);
  2712. }
  2713. //PHOTON NETWORK CALLBACKS END ########################################################################################################################################
  2714.  
  2715. //ROOM ACTIVITY REPORTS ################################################################################################################################################
  2716. void JoinedTeam(int team)
  2717. {
  2718. //team = 0 - spectators, 1 - team A, 2 - team B
  2719. string joinedTeam = "Spectators";
  2720. int colorRef = 0;
  2721.  
  2722. if (team == 1 || team == 2)
  2723. {
  2724. joinedTeam = team == 1 ? GameSettings.teamAName : GameSettings.teamBName;
  2725. colorRef = team;
  2726. }
  2727.  
  2728. photonView.RPC("PostActivityRemote", PhotonTargets.All, PhotonNetwork.playerName + " joined", "", joinedTeam, 0, colorRef);
  2729. }
  2730.  
  2731. public void ReportKill(string killedName, string weaponName, int killedTeam)
  2732. {
  2733. photonView.RPC("PostActivityRemote", PhotonTargets.All, PhotonNetwork.playerName, " " + ourPlayer.playerWeapons.currentSelectedWeapon.killlogWeaponIdentity, killedName, ourTeam, killedTeam);
  2734. //if (killedTeam == 1)
  2735. //GameSettings.rc.teamaplayersalive--;
  2736. //if (killedTeam == 2)
  2737. //GameSettings.rc.teambplayerslive--;
  2738. }
  2739.  
  2740. [PunRPC]
  2741. public void PostActivityRemote(string leftText, string middleText, string rightText, int leftColorRef, int rightColorRef)
  2742. {
  2743. Color leftColorTmp = GameSettings.HUDColor;
  2744. Color rightColorTmp = GameSettings.HUDColor;
  2745.  
  2746. if (leftColorRef == 1 || leftColorRef == 2)
  2747. {
  2748. leftColorTmp = leftColorRef == 1 ? GameSettings.teamAColor : GameSettings.teamBColor;
  2749. }
  2750.  
  2751. if (rightColorRef == 1 || rightColorRef == 2)
  2752. {
  2753. rightColorTmp = rightColorRef == 1 ? GameSettings.teamAColor : GameSettings.teamBColor;
  2754. }
  2755.  
  2756. actionReports.Add(new ActionReport(leftText, middleText, rightText, leftColorTmp, rightColorTmp, 15));
  2757.  
  2758. if (actionReports.Count > 5)
  2759. {
  2760. actionReports.RemoveAt(0);
  2761. }
  2762. }
  2763. //ROOM ACTIVITY REPORTS END ############################################################################################################################################
  2764.  
  2765. //Player HUD controllers
  2766. public void DoHitDetector(int direction)
  2767. {
  2768.  
  2769. if (direction > 0 && direction < 5)
  2770. {
  2771. if (direction == 1)
  2772. {
  2773. hitTopFade = 1;
  2774. }
  2775. if (direction == 2)
  2776. {
  2777. hitBottomFade = 1;
  2778. }
  2779. if (direction == 3)
  2780. {
  2781. hitLeftFade = 1;
  2782. }
  2783. if (direction == 4)
  2784. {
  2785. hitRightFade = 1;
  2786. }
  2787. }
  2788. else
  2789. {
  2790. hitTopFade = 1;
  2791. hitBottomFade = 1;
  2792. hitLeftFade = 1;
  2793. hitRightFade = 1;
  2794. }
  2795.  
  2796. redScreenFade = 1;
  2797.  
  2798. if (!doingHitDetector)
  2799. {
  2800. StartCoroutine(DoHitDetectorCoroutine());
  2801. }
  2802. }
  2803.  
  2804. IEnumerator DoHitDetectorCoroutine()
  2805. {
  2806. doingHitDetector = true;
  2807.  
  2808. while (redScreenFade > 0.01f)
  2809. {
  2810. redScreenFade = Mathf.Lerp(redScreenFade, 0, Time.deltaTime * 5);
  2811. hitTopFade = Mathf.Lerp(hitTopFade, 0, Time.deltaTime * 5);
  2812. hitBottomFade = Mathf.Lerp(hitBottomFade, 0, Time.deltaTime * 5);
  2813. hitLeftFade = Mathf.Lerp(hitLeftFade, 0, Time.deltaTime * 5);
  2814. hitRightFade = Mathf.Lerp(hitRightFade, 0, Time.deltaTime * 5);
  2815.  
  2816. yield return null;
  2817. }
  2818.  
  2819. doingHitDetector = false;
  2820. redScreenFade = 0;
  2821. hitTopFade = 0;
  2822. hitBottomFade = 0;
  2823. hitLeftFade = 0;
  2824. hitRightFade = 0;
  2825. }
  2826.  
  2827. public void AddKillCash(int bodyPart)
  2828. {
  2829. if (bodyPart < -1)
  2830. return;
  2831.  
  2832. //bodyPart 0 = head. 1 = torso, 2 = limbs
  2833. scoreToAddTmp = "";
  2834.  
  2835. if (bodyPart == -1)
  2836. {
  2837.  
  2838. }
  2839. else
  2840. {
  2841. if (bodyPart == 0)
  2842. {
  2843.  
  2844. //kongregateAPI.SubmitData("Highscore", rank_xp);
  2845. headshot_start.clip = headshot_sound;
  2846. //announcersfx.PlayOneShot(headshot_sound);
  2847. //Add cash for headshot
  2848. killSteakXP += 1;
  2849. rank_xp += 1;
  2850. totalXP += 1;
  2851. //string statName = "MostKills";
  2852. //string statValue = totalXP.ToString();
  2853. //Kongregate.SubmitStatistic(statName, statValue);
  2854. //Debug.Log("Total XP " + statValue.ToString());
  2855. scoreToAddTmp = "+1";
  2856.  
  2857.  
  2858. /*if (currentGameMode == "BR")
  2859. {
  2860. scoreToAddTmp = "+150";
  2861. LMACash += 150;
  2862. timeToPurchase = 15;
  2863. this.StartCoroutine("PurchaseTimer");
  2864. }
  2865. */
  2866.  
  2867. PlayerPrefs.SetInt("cXP", challengeXP);
  2868. PlayerPrefs.SetInt("GP1", totalCash);
  2869. PlayerPrefs.SetInt("totalKill", totalXP);
  2870. }
  2871. else
  2872. {
  2873. //kongregateAPI.SubmitData("Highscore", rank_xp);
  2874. headshot_start.clip = headshot_sound;
  2875. headshot_start.Play();
  2876. //Add cash for normal kill
  2877. /*if (currentGameMode == "BM")
  2878. {
  2879. dead = true;
  2880. if (dead == true)
  2881. {
  2882. this.StartCoroutine("confirmedKillTime");
  2883. }
  2884. scoreToAddTmp = "3";
  2885. totalCash += 3;
  2886. }
  2887. */
  2888. //kongregateAPI.SubmitData("MostKills", totalXP);
  2889. //string statName = "MostKills";
  2890. //string statValue = totalXP.ToString();
  2891. //rank_xp += 1;
  2892. //Kongregate.SubmitStatistic(statName, statValue);
  2893. //Debug.Log("Total XP " + statValue.ToString());
  2894. totalXP += 1;
  2895. scoreToAddTmp = "+1";
  2896.  
  2897. /*
  2898. if (currentGameMode == "BR")
  2899. {
  2900. scoreToAddTmp = "+150";
  2901. LMACash += 150;
  2902. timeToPurchase = 15;
  2903. this.StartCoroutine("PurchaseTimer");
  2904. }
  2905. */
  2906. /*
  2907. if (currentGameMode == "BM")
  2908. {
  2909. timeToPurchase = 3;
  2910. scoreToAddTmp = "1";
  2911. BMCash += 1;
  2912. this.StartCoroutine("PurchaseTimer");
  2913. }
  2914. */
  2915. PlayerPrefs.SetInt("GP1", totalCash);
  2916. PlayerPrefs.SetInt("totalKill", totalXP);
  2917. }
  2918. }
  2919.  
  2920. currentAddingCashColor = addingColor;
  2921. currentTotalCashColor = addingColor;
  2922.  
  2923. /*audioSource.Stop();
  2924. audioSource.clip = cashRegisterSound;
  2925. audioSource.Play();*/
  2926.  
  2927. if (!addingKillCash && scoreToAddTmp != "")
  2928. {
  2929. StartCoroutine(AddKIllCashCoroutine());
  2930. }
  2931. }
  2932.  
  2933. public void addBotCash()
  2934. {
  2935. timeToPurchase = 3;
  2936. scoreToAddTmp = "1";
  2937. this.StartCoroutine("PurchaseTimer");
  2938. if (currentHP < 95)
  2939. {
  2940. currentHP += 2;
  2941. }
  2942. if (currentHP >= 100)
  2943. {
  2944.  
  2945. }
  2946. }
  2947.  
  2948. public void AddHealth()
  2949. {
  2950. Hashtable setPlayerProperties = new Hashtable();
  2951. setPlayerProperties.Add("PlayerHP", (int)100);
  2952. PhotonNetwork.player.SetCustomProperties(setPlayerProperties);
  2953. //Removed
  2954. //announcersfx.PlayOneShot(healthSFX);
  2955. }
  2956. //Added this void 11/10/2017
  2957. public void damageHealth()
  2958. {
  2959. int currentzeHP = (int)PhotonNetwork.player.customProperties["PlayerHP"];
  2960. currentzeHP -= 5;
  2961. Hashtable setPlayerProperties = new Hashtable();
  2962. setPlayerProperties.Add("PlayerHP", currentzeHP);
  2963. PhotonNetwork.player.SetCustomProperties(setPlayerProperties);
  2964. if (currentzeHP < 1 && teamAPlayers.Count > 1)
  2965. {
  2966. ourPlayer.playerKilled = true;
  2967. StartCoroutine("LastManStandingCoroutine");
  2968. PhotonNetwork.Destroy(ourPlayer.gameObject);
  2969. }
  2970. if (currentzeHP < 1 && teamAPlayers.Count == 1)
  2971. {
  2972. currentGameStatus = 1;
  2973. ResetGameStatus(currentGameStatus, teamAPlayers[0]);
  2974. }
  2975.  
  2976. }
  2977.  
  2978. public void SubstractCash(int type)
  2979. {
  2980. //Substract cash when refilling ammo or purchasing new Weapon. "type" variable used to detect whether it's secondary primay etc.
  2981. scoreToAddTmp = "";
  2982.  
  2983. if (type == -1)
  2984. {
  2985. //Substracting cash for refilling ammo
  2986. if (totalCash >= 100)
  2987. {
  2988. scoreToAddTmp = "100";
  2989. ourPlayer.playerWeapons.currentSelectedWeapon.wSettings.reserveBullets += 30;
  2990. //Play buy sound
  2991. audioSource.Stop();
  2992. audioSource.clip = buySound;
  2993. audioSource.Play();
  2994. }
  2995. }
  2996. else
  2997. {
  2998. if (bm.GetWeaponCost(type) > -1)
  2999. {
  3000. scoreToAddTmp = bm.GetWeaponCost(type).ToString();
  3001.  
  3002.  
  3003. audioSource.Stop();
  3004. audioSource.clip = cashRegisterSound;
  3005. audioSource.Play();
  3006. }
  3007. }
  3008.  
  3009. currentAddingCashColor = substractingColor;
  3010. currentTotalCashColor = substractingColor;
  3011.  
  3012. if (!addingKillCash /*&& scoreToAddTmp != ""*/)
  3013. {
  3014. StartCoroutine(AddKIllCashCoroutine());
  3015. }
  3016. }
  3017.  
  3018.  
  3019. public int GetCash()
  3020. {
  3021. Debug.Log(cm6.kreds);
  3022. return GameSettings.cnst = totalCash;
  3023. }
  3024.  
  3025. IEnumerator AddKIllCashCoroutine()
  3026. {
  3027. addingKillCash = true;
  3028.  
  3029. addingColorFadeTo = new Color(currentAddingCashColor.r, currentAddingCashColor.g, currentAddingCashColor.b, 0);
  3030.  
  3031. while (Mathf.Abs(((Vector4)GameSettings.HUDColor).magnitude - ((Vector4)currentTotalCashColor).magnitude) > 0.01f)
  3032. {
  3033. currentTotalCashColor = Color.Lerp(currentTotalCashColor, GameSettings.HUDColor, Time.deltaTime * 0.5f);
  3034. currentAddingCashColor = Color.Lerp(currentAddingCashColor, addingColorFadeTo, Time.deltaTime * 0.5f);
  3035. yield return null;
  3036. }
  3037.  
  3038. currentAddingCashColor = addingColorFadeTo;
  3039. currentTotalCashColor = GameSettings.HUDColor;
  3040. addingKillCash = false;
  3041. }
  3042. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement