Ejemplo n.º 1
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Player1(Black)" || other.tag == "Player2(White)" || other.tag == "Player3" || other.tag == "Player4")
     {
         //if we hit a player not our team Explode
         playerHealthScript = other.GetComponent <PlayerHealth>();
         if (playerHealthScript.teamCount != teamCount)
         {
             BlowUp();
         }
     }
     else if (other.tag == "Asteroid")
     {
         BlowUp();
     }
     else if (other.tag == "RocketAmmo")
     {
         rocketScript = other.GetComponent <RemoteLauncherShot>();
         if (rocketScript.teamCount != teamCount)
         {
             BlowUp();
         }
     }
     else if (other.tag == "SniperBullet")
     {
         bulletScript = other.GetComponent <LineSniperShot>();
         if (bulletScript.teamCount != teamCount)
         {
             BlowUp();
         }
     }
     else if (other.tag == "Shot")
     {
         shotScript = other.GetComponent <ProtoShotPrefab>();
         if (shotScript.teamCount != teamCount)
         {
             BlowUp();
         }
     }
     else if (other.tag == "ShieldMine")
     {
         mineScript = other.GetComponent <ShieldMine>();
         if (mineScript.teamCount != teamCount)
         {
             BlowUp();
         }
     }/*
       * else if (other.tag == "Plasma")
       * {
       * plasmaScript = other.GetComponent<Plasma>();
       * if (plasmaScript.teamCount != teamCount)
       * {
       *     BlowUp();
       * }
       * }*/
     else if (other.tag == "DamageBug")
     {
         damageBugScript = other.GetComponent <DamageBug>();
         if (damageBugScript.teamCount != teamCount)
         {
             BlowUp();
         }
     }
     else if (other.tag == "Missile")
     {
         seekerShotScript = other.GetComponent <EnemySeekerShot>();
         if (seekerShotScript.teamCount != teamCount)
         {
             BlowUp();
         }
     }
     else if (other.tag == "TripMine")
     {
         tripMineScript = other.GetComponent <TripMine>();
         if (tripMineScript.teamCount != teamCount)
         {
             BlowUp();
         }
     }
     else if (other.tag == "AutoTurretHitBox")
     {
         autoTurretScript = other.GetComponentInParent <AutoTurret>();
         if (autoTurretScript.teamCount != teamCount)
         {
             BlowUp();
         }
     }
     else if (other.tag == "Junk")
     {
         BlowUp();
     }
 }
Ejemplo n.º 2
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Boundary" || other.tag == "MineralPickup" || other.tag == "Capsule" || other.tag == "Edge" || other.tag == "Map" || other.tag == "Ibeam")
     {
         return;
     }
     else if (other.tag == "RocketAmmo")
     {
         rocketScript = other.GetComponent <RemoteLauncherShot>();
         if (rocketScript.teamCount != teamCount)
         {
             //Debug.Log(teamCount + " |other: " + rocketScript.teamCount);
             if (hitCount > 1)
             {
                 Destroy(this.gameObject);
             }
             else
             {
                 hitCount++;
             }
         }
     }
     else if (other.tag == "SniperBullet")
     {
         bulletScript = other.GetComponent <LineSniperShot>();
         if (bulletScript.teamCount != teamCount)
         {
             //Debug.Log(teamCount + " |other: " + bulletScript.teamCount);
             if (hitCount > 1)
             {
                 Destroy(this.gameObject);
             }
             else
             {
                 hitCount++;
             }
         }
     }
     else if (other.tag == "Missile")
     {
         homingMissileScript = other.GetComponent <EnemySeekerShot>();
         if (homingMissileScript.teamCount != teamCount)
         {
             if (hitCount > 1)
             {
                 Destroy(this.gameObject);
             }
             else
             {
                 hitCount++;
             }
         }
     }
     else if (other.tag == "Shot")
     {
         shotScript = other.GetComponent <ProtoShotPrefab>();
         if (shotScript.teamCount != teamCount)
         {
             //Debug.Log(teamCount + " |other: " + shotScript.teamCount);
             if (hitCount > 1)
             {
                 Destroy(this.gameObject);
             }
             else
             {
                 hitCount++;
             }
         }
     }
     else if (other.tag == "Player1(Black)" || other.tag == "Player2(White)" || other.tag == "Player3" || other.tag == "Player4")
     {
         enemyHealthScript = other.GetComponent <PlayerHealth>();
         if (enemyHealthScript.teamCount != teamCount)
         {
             enemyHealthScript.Damage(mineDamage, false);
             Destroy(this.gameObject);
         }
     }
     else if (other.tag == "PlayerPhysicsCollider")
     {
         enemyHealthScript = other.GetComponentInParent <PlayerHealth>();
         if (enemyHealthScript.teamCount != teamCount)
         {
             enemyHealthScript.Damage(mineDamage, false);
             Destroy(this.gameObject);
         }
     }
     else if (other.tag == "Asteroid")
     {
         asteroidScript = other.GetComponent <Asteroid>();
         asteroidScript.DamageAsteroid(mineDamage);
         Destroy(this.gameObject);
     }
     else if (other.tag == "Plasma")
     {
         plasmaScript = other.GetComponent <Plasma>();
         if (plasmaScript.teamCount != teamCount)
         {
             if (hitCount > 1)
             {
                 Destroy(this.gameObject);
             }
             else
             {
                 hitCount++;
             }
         }
     }
 }
Ejemplo n.º 3
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Boundary" || other.tag == "MineralPickup" || other.tag == "Capsule" || other.tag == "Edge" || other.tag == "BoostHit" || other.tag == "AutoTurret")
     {
         //Debug.Log("hit boundary/mineralpickup/capsule/edge");
         return;
     }
     else if (other.tag == "Player1(Black)" || other.tag == "Player2(White)" || other.tag == "Player3" || other.tag == "Player4")
     {
         //Debug.Log("SniperHit " + other.tag);
         enemyHealthScript = other.GetComponent <PlayerHealth>();
         if (enemyHealthScript.teamCount != teamCount)
         {
             enemyHealthScript.Damage(lineSniperShotDamage, false);
             DestroyThis();
         }
     }
     else if (other.tag == "Enemy")
     {
         aiHealthScript = other.GetComponent <EnemyHealth>();
         aiHealthScript.DamageEnemy(lineSniperShotDamage);
         DestroyThis();
     }
     else if (other.tag == "PlayerPhysicsCollider")
     {
         //Debug.Log("SniperHit " + other.tag);
         enemyHealthScript = other.GetComponentInParent <PlayerHealth>();
         if (enemyHealthScript.teamCount != teamCount)
         {
             enemyHealthScript.Damage(lineSniperShotDamage, false);
             DestroyThis();
         }
     }
     else if (other.tag == "RocketAmmo")
     {
         rocketScript = other.GetComponent <RemoteLauncherShot>();
         if (rocketScript.teamCount != teamCount)
         {
             DestroyThis();
         }
     }
     else if (other.tag == "SniperBullet")
     {
         bulletScript = other.GetComponent <LineSniperShot>();
         if (bulletScript.teamCount != teamCount)
         {
             DestroyThis();
         }
     }
     else if (other.tag == "Shot")
     {
         shotScript = other.GetComponent <ProtoShotPrefab>();
         if (shotScript.teamCount != teamCount)
         {
             DestroyThis();
         }
     }
     else if (other.tag == "ShieldMine")
     {
         mineScript = other.GetComponent <ShieldMine>();
         if (mineScript.teamCount != teamCount)
         {
             DestroyThis();
         }
     }
     else if (other.tag == "Asteroid")
     {
         //Debug.Log("hit asteroid");
         asteroidScript = other.GetComponent <Asteroid>();
         asteroidScript.DamageAsteroid(lineSniperShotDamage);
         pierceCount                -= 1;
         instance                    = Instantiate(deathParticles, transform.position, Quaternion.identity) as GameObject;
         deathParticleSys            = instance.GetComponent <ParticleSystem>();
         deathParticleSys.startColor = color;
         if (pierceCount < 1)
         {
             DestroyThis();
         }
     }
     else if (other.tag == "Plasma")
     {
     }
     else if (other.tag == "PhaseBlast")
     {
     }
     else
     {
         //Debug.Log("hit " + other.tag);
         DestroyThis();
     }
 }
Ejemplo n.º 4
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "Boundary" || other.tag == "MineralPickup" || other.tag == "Capsule" || other.tag == "Edge" || other.tag == "BoostHit" || other.tag == "AutoTurret")
        {
            return;
        }
        else if (other.tag == "Player1(Black)" || other.tag == "Player2(White)" || other.tag == "Player3" || other.tag == "Player4")
        {
            enemyHealthScript = other.GetComponent <PlayerHealth>();
            if (enemyHealthScript.teamCount != teamCount)
            {
                BlowUp();
                DestroyThis();
            }
        }
        else if (other.tag == "PlayerPhysicsCollider")
        {
            enemyHealthScript = other.GetComponentInParent <PlayerHealth>();
            if (enemyHealthScript.teamCount != teamCount)
            {
                BlowUp();
                DestroyThis();
            }
        }
        else if (other.tag == "RocketAmmo")
        {
            rocketScript = other.GetComponent <RemoteLauncherShot>();
            if (rocketScript.teamCount != teamCount)
            {
                BlowUp();
                DestroyThis();
            }
        }
        else if (other.tag == "SniperBullet")
        {
            bulletScript = other.GetComponent <LineSniperShot>();
            if (bulletScript.teamCount != teamCount)
            {
                BlowUp();
                DestroyThis();
            }
        }
        else if (other.tag == "Shot")
        {
            shotScript = other.GetComponent <ProtoShotPrefab>();
            if (shotScript.teamCount != teamCount)
            {
                rapidShotHitCount++;
                if (rapidShotHitCount > totalShotHit)
                {
                    BlowUp();
                    DestroyThis();
                }
                else
                {
                    return;
                }
            }
        }
        else if (other.tag == "ShieldMine")
        {
            mineScript = other.GetComponent <ShieldMine>();
            if (mineScript.teamCount != teamCount)
            {
                BlowUp();
                DestroyThis();
            }
        }
        else if (other.tag == "Plasma")
        {
            /*
             * plasmaScript = other.GetComponent<Plasma>();
             * if (plasmaScript.teamCount != teamCount)
             * {
             *  plasmaHitCount++;
             *  if (plasmaHitCount > totalPlasmaHit)
             *  {
             *      BlowUp();
             *      DestroyThis();
             *  }
             *  else
             *  {
             *      return;
             *  }
             * }
             */
        }
        else if (other.tag == "PhaseBlast")
        {
            phaseBlastScript = other.GetComponent <PhaseBlast>();
            if (phaseBlastScript.teamCount != teamCount)
            {
                BlowUp();
                DestroyThis();
            }
        }
        else if (other.tag == "Grenade")
        {
            grenadeScript = other.GetComponent <Grenade>();
            if (grenadeScript.teamCount != teamCount)
            {
                BlowUp();
                DestroyThis();
            }
        }
        else if (other.tag == "Asteroid")
        {
            BlowUp();
            DestroyThis();
        }
        else
        {
            BlowUp();
            DestroyThis();
        }

        /*
         * myShotScript.newRemoteLauncherCoolDown = myShotScript.newRemoteLauncherCoolDownTime;
         * myShotScript.rocketFired = false;
         */
    }
Ejemplo n.º 5
0
 void BlowUp()
 {
     if (!exploded)
     {
         exploded = true;
         if (this != null)
         {
             Collider2D[] hitThings = Physics2D.OverlapCircleAll(transform.position, blastRadius);
             if (hitThings != null)
             {
                 for (int i = 0; i < hitThings.Length; i++)
                 {
                     if (hitThings[i].tag == "Player1(Black)" || hitThings[i].tag == "Player2(White)" || hitThings[i].tag == "Player3" || hitThings[i].tag == "Player4")
                     {
                         enemyHealthScript = hitThings[i].GetComponent <PlayerHealth>();
                         if (enemyHealthScript.teamCount != teamCount)
                         {
                             enemyHealthScript.Damage(blastDamage, false);
                         }
                     }
                     else if (hitThings[i].tag == "Enemy")
                     {
                         aiHealthScript = hitThings[i].GetComponent <EnemyHealth>();
                         aiHealthScript.DamageEnemy(blastDamage);
                     }
                     else if (hitThings[i].tag == "Asteroid")
                     {
                         asteroidScript = hitThings[i].GetComponent <Asteroid>();
                         asteroidScript.DamageAsteroid(blastDamage);
                     }
                     else if (hitThings[i].tag == "RocketAmmo")
                     {
                         rocketScript = hitThings[i].GetComponent <RemoteLauncherShot>();
                         if (rocketScript.teamCount != teamCount)
                         {
                             rocketScript.DestroyThis();
                         }
                     }
                     else if (hitThings[i].tag == "DamageBug")
                     {
                         damageBugScript = hitThings[i].transform.GetComponent <DamageBug>();
                         if (damageBugScript.teamCount != teamCount)
                         {
                             //damage the bug
                             damageBugScript.DamageThis(blastDamage);
                         }
                     }
                     else if (hitThings[i].tag == "AutoTurretHitBox")
                     {
                         autoTurretScript = hitThings[i].transform.GetComponentInParent <AutoTurret>();
                         if (autoTurretScript != null)
                         {
                             if (autoTurretScript.teamCount != teamCount)
                             {
                                 //damage the Turret
                                 autoTurretScript.DamageThis(blastDamage);
                             }
                         }
                     }
                     else if (hitThings[i].tag == "TripMine")
                     {
                         tripMineScript = hitThings[i].transform.GetComponent <TripMine>();
                         if (tripMineScript.teamCount != teamCount)
                         {
                             //Blow up tripMine
                             tripMineScript.BlowUp();
                         }
                     }
                     else if (hitThings[i].tag == "Junk")
                     {
                         junkScript = hitThings[i].GetComponent <JunkHealth>();
                         junkScript.DamageJunk(blastDamage);
                     }
                 }
                 DestroyThis();
             }
             else
             {
                 //Debug.Log("hit nothin");
             }
             DestroyThis();
         }
     }
 }
Ejemplo n.º 6
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Boundary" || other.tag == "MineralPickup" || other.tag == "Capsule" || other.tag == "Edge" || other.tag == "BoostHit" || other.tag == "AutoTurret")
     {
         //Debug.Log("hit boundary/mineralpickup/capsule/edge");
         return;
     }
     else if (other.tag == "Player1(Black)" || other.tag == "Player2(White)" || other.tag == "Player3" || other.tag == "Player4")
     {
         //Debug.Log("ShotHit " + other.tag);
         enemyHealthScript = other.GetComponent <PlayerHealth>();
         if (enemyHealthScript.teamCount != teamCount)
         {
             enemyHealthScript.Damage(shotDamage, false);
             DestroyThis();
         }
     }
     else if (other.tag == "Enemy")
     {
         aiHealthScript = other.GetComponent <EnemyHealth>();
         if (aiHealthScript.teamCount != teamCount)
         {
             aiHealthScript.DamageEnemy(shotDamage);
             DestroyThis();
         }
     }
     else if (other.tag == "PlayerPhysicsCollider")
     {
         //Debug.Log("ShotHit " + other.tag);
         enemyHealthScript = other.GetComponentInParent <PlayerHealth>();
         if (enemyHealthScript.teamCount != teamCount)
         {
             enemyHealthScript.Damage(shotDamage, false);
             DestroyThis();
         }
     }
     else if (other.tag == "RocketAmmo")
     {
         rocketScript = other.GetComponent <RemoteLauncherShot>();
         if (rocketScript.teamCount != teamCount)
         {
             DestroyThis();
         }
     }
     else if (other.tag == "SniperBullet")
     {
         bulletScript = other.GetComponent <LineSniperShot>();
         if (bulletScript.teamCount != teamCount)
         {
             DestroyThis();
         }
     }
     else if (other.tag == "Shot")
     {
         shotScript = other.GetComponent <ProtoShotPrefab>();
         if (shotScript.teamCount != teamCount)
         {
             DestroyThis();
         }
     }
     else if (other.tag == "ShieldMine")
     {
         mineScript = other.GetComponent <ShieldMine>();
         if (mineScript.teamCount != teamCount)
         {
             DestroyThis();
         }
     }
     else if (other.tag == "Asteroid")
     {
         //Debug.Log("hit asteroid");
         asteroidScript = other.GetComponent <Asteroid>();
         asteroidScript.DamageAsteroid(shotDamage);
         DestroyThis();
     }
     else if (other.tag == "Plasma")
     {
     }
     else if (other.tag == "PhaseBlast")
     {
     }
     else
     {
         //Debug.Log("hit " +other.tag);
         DestroyThis();
     }
 }
Ejemplo n.º 7
0
 void BlowUp()
 {
     if (this != null)
     {
         Collider2D[] hitThings = Physics2D.OverlapCircleAll(transform.position, range);
         if (hitThings != null)
         {
             for (int i = 0; i < hitThings.Length; i++)
             {
                 if (hitThings[i].tag == "Player1(Black)" || hitThings[i].tag == "Player2(White)" || hitThings[i].tag == "Player3" || hitThings[i].tag == "Player4")
                 {
                     playerHealthScript = hitThings[i].GetComponent <PlayerHealth>();
                     if (playerHealthScript.teamCount != teamCount)
                     {
                         playerHealthScript.Damage(grenadeDamage, false);
                     }
                 }
                 else if (hitThings[i].tag == "Asteroid")
                 {
                     asteroidScript = hitThings[i].GetComponent <Asteroid>();
                     asteroidScript.DamageAsteroid(grenadeDamage);
                 }
                 else if (hitThings[i].tag == "RocketAmmo")
                 {
                     rocketScript = hitThings[i].GetComponent <RemoteLauncherShot>();
                     if (rocketScript.teamCount != teamCount)
                     {
                         rocketScript.DestroyThis();
                     }
                 }
                 else if (hitThings[i].tag == "DamageBug")
                 {
                     damageBugScript = hitThings[i].transform.GetComponent <DamageBug>();
                     if (damageBugScript.teamCount != teamCount)
                     {
                         //damage the bug
                         damageBugScript.DamageThis(grenadeDamage);
                     }
                 }
                 else if (hitThings[i].tag == "AutoTurretHitBox")
                 {
                     autoTurretScript = hitThings[i].transform.GetComponentInParent <AutoTurret>();
                     if (autoTurretScript != null)
                     {
                         if (autoTurretScript.teamCount != teamCount)
                         {
                             //damage the Turret
                             autoTurretScript.DamageThis(grenadeDamage);
                         }
                     }
                 }
                 else if (hitThings[i].tag == "TripMine")
                 {
                     tripMineScript = hitThings[i].transform.GetComponent <TripMine>();
                     if (tripMineScript.teamCount != teamCount)
                     {
                         //Blow up tripMine
                         tripMineScript.BlowUp();
                     }
                 }
                 else if (hitThings[i].tag == "Junk")
                 {
                     junkScript = hitThings[i].GetComponent <JunkHealth>();
                     junkScript.DamageJunk(grenadeDamage);
                 }
             }
         }
         Destroy(this.gameObject, 3f);
     }
 }