protected void Start() { _playerUnit = SpawnPlayer(); SetHealthText(); //Starts a new coroutine. StartCoroutine(SpawnEnemyRoutine()); }
// Moves player to spawn position after dying. // Also sets players died parameter to false. public void Respawn() { GameObject spawnPlayer = _PlayerSpawner.Spawn(); PlayerSpaceship playerShip = spawnPlayer.GetComponent <PlayerSpaceship>(); _PlayerShip = playerShip; _PlayerObject = spawnPlayer; _JustSpawned = true; Debug.Log("Respawned"); }
// Playerships initial spawn method. private void SpawnPlayer() { GameObject spawnPlayer = _PlayerSpawner.Spawn(); PlayerSpaceship playerShip = spawnPlayer.GetComponent <PlayerSpaceship>(); _PlayerShip = playerShip; _PlayerObject = spawnPlayer; _PlayerLives = _PlayerShip.Lives; Debug.Log("Spawned"); }
public void LivesLost() { if (GameManager.Instance.CurrentLives <= 0) { } else { _playerUnit = SpawnPlayer(); } }
protected void Start() { // Setting the health text in the Start method. SetHealthText(); //Starts a new coroutine. StartCoroutine(SpawnEnemyRoutine()); // This was changed. _playerUnit = SpawnPlayer(); }
void Update() { if (_playerUnit.GetComponent <Health>().CurrentHealth <= 0) { if (_playerUnit.playerLives > 0) { PlayerSpaceship player = SpawnPlayer(); _playerUnit.GetComponent <Health>().IncreaseHealth(_playerUnit.GetComponent <Health>().MaximumHealth); } } SetHealthText(); }
public void LivesLost() { if (GameManager.Instance.CurrentLives <= 0) { GameStateController.PerformTransition(GameStateType.GameOver); } else { // This was changed. _playerUnit = SpawnPlayer(); } }
public PlayerSpaceship SpawnPlayer() { PlayerSpaceship playerShip = null; GameObject spawnedPlayerObject = _playerSpawner.Spawn(); if (spawnedPlayerObject != null) { playerShip = spawnedPlayerObject.GetComponent <PlayerSpaceship>(); } playerShip.BecomeImmortal(); return(playerShip); }
void Update() { // Setting the health text in the Update method. SetHealthText(); if (_playerUnit.GetComponent <Health>().CurrentHealth <= 0) { if (_playerUnit.playerLives > 0) { PlayerSpaceship player = SpawnPlayer(); _playerUnit.GetComponent <Health>().IncreaseHealth(_playerUnit.GetComponent <Health>().MaximumHealth); Debug.Log("Totally spawned again, dude!"); } } }
public PlayerSpaceship SpawnPlayer() { PlayerSpaceship playerShip = null; GameObject spawnedPlayerObject = _playerSpawner.Spawn(); if (spawnedPlayerObject != null) { playerShip = spawnedPlayerObject.GetComponent <PlayerSpaceship>(); } playerShip.BecomeImmortal(); return(playerShip); //if (_playerUnit.playerLives > 0) //{ // _playerSpawner.Spawn(); // _playerUnit.GetComponent<Health>().IncreaseHealth(_playerUnit.GetComponent<Health>().MaximumHealth); //} }