protected void Start()
        {
            _playerUnit = SpawnPlayer();
            SetHealthText();

            //Starts a new coroutine.
            StartCoroutine(SpawnEnemyRoutine());
        }
Exemplo n.º 2
0
        // 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");
        }
Exemplo n.º 3
0
        // 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();
     }
 }
Exemplo n.º 5
0
        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();
 }
Exemplo n.º 7
0
 public void LivesLost()
 {
     if (GameManager.Instance.CurrentLives <= 0)
     {
         GameStateController.PerformTransition(GameStateType.GameOver);
     }
     else
     {
         // This was changed.
         _playerUnit = SpawnPlayer();
     }
 }
Exemplo n.º 8
0
        public PlayerSpaceship SpawnPlayer()
        {
            PlayerSpaceship playerShip          = null;
            GameObject      spawnedPlayerObject = _playerSpawner.Spawn();

            if (spawnedPlayerObject != null)
            {
                playerShip = spawnedPlayerObject.GetComponent <PlayerSpaceship>();
            }

            playerShip.BecomeImmortal();

            return(playerShip);
        }
Exemplo n.º 9
0
        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);
            //}
        }