Esempio n. 1
0
    ////////////////////////////////////////////////////////////

    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Asteroid" || other.gameObject.tag == "EnemyShip")
        {
            Ship.DoDamage(1);
            checkDamage();
        }

        if (other.gameObject.tag == "LaserRed")
        {
            Debug.Log("playerHit");
            Ship.DoDamage(1); // TODO: Change to use the projectile data
            checkDamage();

            Instantiate(laserHit, transform.position, Quaternion.identity, transform);
            Destroy(other.gameObject);
        }

        if (other.gameObject.tag == "energyPowerup")
        {
            Ship.WeaponEnergy += Ship.WeaponEnergyMax / 5;

            GameObject collectParticles = Instantiate(GameManager.Instance.PowerupCollect, transform);
            Destroy(collectParticles, 3f);

            Destroy(other.gameObject);
        }

        if (other.gameObject.tag == "healthPowerup")
        {
            Ship.DoHeal(Ship.MaxHealth / 5); // TODO: Change this if a proper power up system is implemented

            GameObject collectParticles = Instantiate(GameManager.Instance.PowerupCollect, transform);
            Destroy(collectParticles, 3f);

            Destroy(other.gameObject);
        }
    }