/// <summary> /// Players has died. /// </summary> public void playerDied() { Debug.Log("Zabity"); audioSource.PlayOneShot(explosionSound); GameObject cExplosion = (GameObject)Instantiate(explosion, transform.position, Quaternion.identity); Destroy(cExplosion, 1.0f); graphics.SetActive(false); isDead = true; deads++; // update game score singlePlayerGameController.UpdateScoreTeamBlue(-1000); StartCoroutine(Respawn()); }
// Update is called once per frame void Update() { playerTimer += Time.deltaTime; bot1Timer += Time.deltaTime; bot2Timer += Time.deltaTime; bot3Timer += Time.deltaTime; if (playerInside && playerTimer > timeBetween) { playerTimer = 0f; if (baloonPoint < maxPoint) { baloonPoint++; singlePlayerController.UpdatePoints(1); if (baloonPoint == maxPoint) { singlePlayerController.UpdatePoints(100); } } } if (boot1Inside && bot1Timer > timeBetween) { bot1Timer = 0f; if (baloonPoint > minPoint) { baloonPoint--; singlePlayerBoot1Controller.UpdatePoints(1); if (baloonPoint == minPoint) { singlePlayerBoot1Controller.UpdatePoints(100); } } } if (boot2Inside && bot2Timer > timeBetween) { bot2Timer = 0f; if (baloonPoint > minPoint) { baloonPoint--; singlePlayerBoot2Controller.UpdatePoints(1); if (baloonPoint == minPoint) { singlePlayerBoot2Controller.UpdatePoints(100); } } } if (boot3Inside && bot3Timer > timeBetween) { bot3Timer = 0f; if (baloonPoint > minPoint) { baloonPoint--; singlePlayerBoot3Controller.UpdatePoints(1); if (baloonPoint == minPoint) { singlePlayerBoot3Controller.UpdatePoints(100); } } } if (baloonPoint == maxPoint) { isCapturedByEnemy = true; baloonGO.GetComponent <MeshRenderer> ().material = blue; singlePlayerGameController.UpdateScoreTeamRed(-1); } else if (baloonPoint == minPoint) { isCapturedByEnemy = false; baloonGO.GetComponent <MeshRenderer> ().material = red; singlePlayerGameController.UpdateScoreTeamBlue(-1); } }