void Start() { Wounded_Panel = GameObject.FindGameObjectWithTag("WPanel"); quitting = false; if (networkView.isMine || BasicFunctions.playOffline) { Wounded_Panel.SetActive(false); if (!BasicFunctions.playOffline) { activeAccount.Number = playerNumber; if (!referee) { referee = GameObject.FindGameObjectWithTag("Referee_Tag").GetComponent <Referee_script>(); } if (!Wounded_Panel) { Wounded_Panel = GameObject.FindGameObjectWithTag("WPanel"); } Leven1 = GameObject.FindGameObjectWithTag("Leven1"); Leven2 = GameObject.FindGameObjectWithTag("Leven2"); Leven3 = GameObject.FindGameObjectWithTag("Leven3"); } Screen.lockCursor = true; rigidbody.freezeRotation = true; Gravity_Direction = Initial_Gravity_Direction; spawnScript = GameObject.FindGameObjectWithTag("SpawnTag").GetComponent <NW_Spawning> (); JumpTime = Time.time; if (!BasicFunctions.playOffline) { networkView.RPC("Loop_toch_naar_de_tering", RPCMode.All, "Walk"); } //anim.SetBool("Walk", true); } }
void Update() { if (!Allplayers_Spawned) { Debug.Log("has not yet found all players"); tmp = GameObject.FindGameObjectsWithTag("Player"); if (tmp.Length == playerCount) { if (!spawnScript) { spawnScript = GameObject.FindGameObjectWithTag("SpawnTag").GetComponent <NW_Spawning>(); } Debug.Log("has found all players"); for (int i = 0; i < playerCount; i++) { for (int j = 0; j < playerCount; j++) { if (tmp[j].GetComponent <playerController>().playerNumber == i + 1) { players.Add(tmp[j].GetComponent <playerController>()); break; } } } if (players.Count == playerCount) { Allplayers_Spawned = true; } } } }
void Update() { if (ColorRed && Time.time > ColorChangeTime) { hitColorRegular(); } if (showWP) { Wounded_Panel.SetActive(true); WoundedTimer -= Time.deltaTime; if (WoundedTimer <= 0) { Wounded_Panel.SetActive(false); WoundedTimer = 0.2f; showWP = false; } } if (Input.GetKeyDown(KeyCode.Escape) && quitting == false) { quitting = true; if (!spawnScript) { spawnScript = GameObject.FindGameObjectWithTag("SpawnTag").GetComponent <NW_Spawning> (); } if (BasicFunctions.playOffline) { Application.LoadLevel("Menu_New"); } else if (Network.isServer && networkView.isMine) { Debug.Log("ISSERVER"); dontDestroy = true; string gamemode; if (!endGame) { if (BasicFunctions.ForkModus) { gamemode = "FORK"; } else { gamemode = "RAILGUN"; } if (BasicFunctions.loginServer) { endGame = true; string url = "http://drproject.twi.tudelft.nl:8082/GameRegister?Server=" + BasicFunctions.activeAccount.Name + "&Finished=0" + "&Gamemode=" + gamemode; WWW www = new WWW(url); StartCoroutine(WaitForGameLog(www)); } else { spawnScript.closeServer(false); } } else { spawnScript.closeServer(true); } } else if (Network.isClient || networkView.isMine) { Debug.Log("ISGEENSERVER"); if (spawnScript.serverHasQuit) { spawnScript.closeClient(true, true); } else if (endGame) { spawnScript.closeClient(false, true); } else { spawnScript.closeClient(false, false); } } } if (Input.GetKeyDown(KeyCode.C)) { Screen.lockCursor = true; Screen.showCursor = false; } }