Exemplo n.º 1
0
    //TODO Explosion 1: Add more depth to the Explosion
    //TODO Explosion 2: i.e. Explosions can only affect Bombers that are solid

    private void OnTriggerEnter2D(Collider2D hitInfo)
    {
        SE.Bomber enemy = hitInfo.GetComponent <SE.Bomber>();
        if (enemy != null)
        {
            enemy.DestroyBomber();
        }
    }
Exemplo n.º 2
0
 private void OnCollisionEnter2D(Collision2D hitInfo)
 {
     SE.Bomber enemy = hitInfo.gameObject.GetComponent <SE.Bomber>();
     if (enemy != null)
     {
         health = health - 1;
         if (health <= 0)
         {
             health = 0;
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Spawns a new bomber, happens in "Bomber" script
        /// </summary>
        public void SpawnAnotherBomberOnDeath(Bomber deadBomber)
        {
            _bombersList.Remove(deadBomber);

            if (_bombersList.Count > _maximumSpawnAmount)
                return;

            _spawnChance = Random.Range(0, 2);

            // Makes it so that Bombers don't spawn every single time
            if (_spawnChance < _spawnChanceValue)
            {
                var position = GetRandomOffScreenPosition();
                var newBomber = Instantiate(bomber, position, Quaternion.identity);
                newBomber.playerTarget = playerInput.transform;

                var phaseShift = newBomber.GetComponent<PhaseShiftEnemy>();
                phaseShift.RandomPhase();
                _bombersList.Add(newBomber);
            }
        }