public void Start() { if (instance != null) { Destroy(gameObject); return; } instance = this; CurrentRespawnPoint = transform.position; timeManager.enabled = false; playerRigidbody.useGravity = false; InputManager.instance.OnAnyInputDown += () => { if (pausedGameAtSpawn) { UnfreezeGame(); } }; InputManager.instance.OnRespawn += () => { teleportPlayerToLastRespawnPoint(); }; initialized = true; if (triedToTeleportToRespawnPointBeforeInitialized) { teleportPlayerToLastRespawnPoint(); } }
public void Initialise() { SetScore(DefaultScore); SetHealth(DefaultHealth); SetLives(DefaultLives); respawnPointController = GameObject.FindObjectOfType <RespawnPointController>(); playerController = GameObject.FindObjectOfType <PlayerController>(); mainController = GameObject.FindObjectOfType <MainController>(); CheckLivesRemain(); }
// Use this for initialization void Start() { sr = GetComponent <SpriteRenderer>(); sr.transform.localScale = Vector3.one * lazerRadius * 2f; player = GameObject.Find("Player"); rb = player.GetComponent <Rigidbody>(); rpc = GameObject.Find("RespawnPoint").GetComponent <RespawnPointController>(); //start the infinite coroutine StartCoroutine(FireLazer()); }
void Start() { GameDifficulty = PlayerPrefs.GetInt(GameDifficultyPrefs, 0); StartCoroutine(StartTimer()); UpdateWaveDisplay(); totalEnemiesInWave = initialNumberOfEnemies; MoveSpawner(); StartCoroutine(SpawnEnemies()); respawnPointController = GameObject.FindObjectOfType <RespawnPointController>(); respawnPointController.Respawn(); }