Example #1
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "PlayerProjectile")
        {
            SpawnExplosionParticles();

            SpawnPickup();

            PlayerShipCtrl.ModScore(pointValue);

            StartDestroy(shipDestroySfx.length);

            GetComponent <AudioSource>().PlayOneShot(shipDestroySfx);
        }
        else if (other.tag == "PlayerShip")
        {
            SpawnExplosionParticles();

            PlayerShipCtrl.ModScore(-1);

            PlayerShipCtrl.ModShield(-1);

            StartDestroy(shipDestroySfx.length);

            GetComponent <AudioSource>().PlayOneShot(shipDestroySfx);
        }
    }
    public void ModShield(int value)
    {
        if (CurEShield >= 1)
        {
            CurEShield += value;
        }

        if (CurEShield == 0)
        {
            Destroy(gameObject);
            SpawnPickup();

            PlayerShipCtrl.ModScore(pointValue);
        }
    }
    public void ModShield(int value)
    {
        if (CurEShield >= 1)
        {
            CurEShield += value;

            GetComponent <AudioSource>().PlayOneShot(shieldHitSfx);
        }

        if (CurEShield == 0)
        {
            SpawnExplosionParticles();

            SpawnPickup();

            PlayerShipCtrl.ModScore(pointValue);

            StartDestroy(shipDestroySfx.length);

            GetComponent <AudioSource>().PlayOneShot(shipDestroySfx);
        }
    }
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "PlayerShip")
        {
            Debug.Log("Hit a Player!");

            Destroy(gameObject, 2.0f);

            //audio
            StartDestroy(shotSfxClip.length);

            ParentShip.ModScore(-1);

            ParentShip.ModShield(-1);

            SpawnHitParticles();
        }
    }
Example #5
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "EnemyShip")
        {
            Debug.Log("Hit an Enemy!");
            Destroy(gameObject, 2.0f);



            ParentShip.ModScore(1);

            ParentShip.ModEnemyHits(1);

            //particle
            SpawnHitParticles();


            //audio
            StartDestroy(shotSfxClip.length);
        }
    }