Exemplo n.º 1
0
 public void StartGame()
 {
     music_source.Stop();
     music_source.Play();
     win              = false;
     lose             = false;
     waiting_to_start = false;
     spawn_manager.CleanUpUnits();
     spawn_manager.StartWaves();
     spawn_manager.enabled = true;
     button_start_game.gameObject.SetActive(false);
     player.live        = 100;
     player.currentAmmo = player.maxAmmo;
     death_hostages     = 0;
     text_amount_death_hostages.text = death_hostages.ToString();
     hostages_die_before             = death_hostages;
     power_up.Reset_Kills();
 }
Exemplo n.º 2
0
    void Shot()
    {
        if (is_infinite_ammo == false)
        {
            currentAmmo--;
        }

        RaycastHit hit;

        Ray r = cam.ScreenPointToRay(transform.position);

        if (Physics.Raycast(r, out hit))
        {
            Target    target = hit.transform.GetComponent <Target>();
            Explosion bomb   = hit.transform.GetComponent <Explosion>();
            Enemy     enemy  = hit.transform.GetComponent <Enemy>();

            if (target != null)
            {
                target.TakeDamage(damage);
            }

            if (bomb != null)
            {
                bomb.Activate_Explosion();
                //powerup_go.bomb_used = true;
            }

            if (enemy != null)
            {
                powerup_go.Increase_kills();
            }

            if (enemy == null && enemy == null && bomb == null)
            {
                //Restart kills
                powerup_go.Reset_Kills();
            }
        }
    }