Exemplo n.º 1
0
 public void Shoot()
 {
     if (playerHealth != null)
     {
         if (HUDHealthScript.timer > 5)
         {
             HUDHealthScript.timer = 0;
         }
         if (playerHealth.currentHealth > 0 && playerHealth.currentHealth <= playerHealth.startingHealth)
         {
             playerHealth.TakeDamage(damage);
             if (GameMasterObject.dannyActive)
             {
                 DannyCameraShake.InstanceD1.ShakeD1(amplitude, duration);
             }
             else if (GameMasterObject.strongmanActive)
             {
                 CameraShake.InstanceSM1.ShakeSM1(amplitude, duration);
             }
         }
         else if (playerHealth.currentHealth > 0 && playerHealth.currentHealth >= playerHealth.startingHealth + 1)
         {
             playerHealth.TakeArmorDamage(damage);
             if (GameMasterObject.dannyActive)
             {
                 DannyCameraShake.InstanceD1.ShakeD1(amplitude, duration);
             }
             else if (GameMasterObject.strongmanActive)
             {
                 CameraShake.InstanceSM1.ShakeSM1(amplitude, duration);
             }
         }
     }
 }
Exemplo n.º 2
0
    void Attack()
    {
        timer = 0f;

        if (playerHealth.currentHealth > 0)
        {
            playerHealth.TakeDamage(attackDamage);
        }
    }
Exemplo n.º 3
0
    public void Attack()
    {
        if (takeDamage)
        {
            if (playerHealth != null)
            {
                if (HUDHealthScript.timer > 5)
                {
                    HUDHealthScript.timer = 0;
                }
                if (playerHealth.currentHealth > 0 && playerHealth.currentHealth <= playerHealth.startingHealth)
                {
                    playerHealth.TakeDamage(damage);

                    if (GameMasterObject.dannyActive)
                    {
                        DannyCameraShake.InstanceD1.ShakeD1(amplitude, duration);
                    }
                    else if (GameMasterObject.strongmanActive)
                    {
                        playerHealth.poisoned = true;
                        playerHealth.poisonEffects++;
                        playerHealth.poisonLeakageTime++;
                        CameraShake.InstanceSM1.ShakeSM1(amplitude, duration);
                    }
                }
                else if (playerHealth.currentHealth > 0 && playerHealth.currentHealth >= playerHealth.startingHealth + 1)
                {
                    playerHealth.TakeArmorDamage(damage);

                    if (GameMasterObject.dannyActive)
                    {
                        DannyCameraShake.InstanceD1.ShakeD1(amplitude, duration);
                    }
                    else if (GameMasterObject.strongmanActive)
                    {
                        playerHealth.poisoned = true;
                        playerHealth.poisonEffects++;
                        playerHealth.poisonLeakageTime++;
                        CameraShake.InstanceSM1.ShakeSM1(amplitude, duration);
                    }
                }
            }
            if (decoyLife != null)
            {
                if (decoyLife != null)
                {
                    decoyLife.shots++;
                }
            }
            if (causeDD != null)
            {
                causeDD.shots += 15;
            }
        }
    }
Exemplo n.º 4
0
 void OnCollisionEnter(Collision other)
 {
     if (other.gameObject.tag == "Player")
     {
         PlayerHealth1 playerHealth = other.gameObject.GetComponent <PlayerHealth1> ();
         if (playerHealth != null)
         {
             HUDHealthScript.timer = 0;
             if (playerHealth.currentHealth > 0 && playerHealth.currentHealth <= playerHealth.startingHealth)
             {
                 playerHealth.TakeDamage(attackDamage * enemyAttackBoost, 100f);
                 if (GameMasterObject.dannyActive)
                 {
                     DannyCameraShake.InstanceD1.ShakeD1(amplitude, duration);
                 }
                 else if (GameMasterObject.strongmanActive)
                 {
                     CameraShake.InstanceSM1.ShakeSM1(amplitude, duration);
                 }
             }
             else if (playerHealth.currentHealth > 0 && playerHealth.currentHealth >= playerHealth.startingHealth + 1)
             {
                 playerHealth.TakeArmorDamage(attackDamage * enemyAttackBoost, 100f);
                 if (GameMasterObject.dannyActive)
                 {
                     DannyCameraShake.InstanceD1.ShakeD1(amplitude, duration);
                 }
                 else if (GameMasterObject.strongmanActive)
                 {
                     CameraShake.InstanceSM1.ShakeSM1(amplitude, duration);
                 }
             }
         }
     }
     if (other.gameObject.tag == "Ally")
     {
         DannyDecoyLifeScript decoyLife = other.gameObject.GetComponent <DannyDecoyLifeScript> ();
         if (decoyLife != null)
         {
             decoyLife.shots++;
         }
     }
     if (other.gameObject.tag == "Cover")
     {
         Destroy(this.gameObject);
     }
     else
     {
         Destroy(this.gameObject);
     }
     Destroy(this.gameObject);
 }
Exemplo n.º 5
0
 public void Attack()
 {
     if (takeDamage)
     {
         if (playerHealth != null)
         {
             if (HUDHealthScript.timer > 5)
             {
                 HUDHealthScript.timer = 0;
             }
             if (playerHealth.currentHealth > 0 && playerHealth.currentHealth <= playerHealth.startingHealth)
             {
                 playerHealth.TakeDamage(damage);
                 if (GameMasterObject.dannyActive)
                 {
                     DannyCameraShake.InstanceD1.ShakeD1(amplitude, duration);
                 }
                 else if (GameMasterObject.strongmanActive)
                 {
                     CameraShake.InstanceSM1.ShakeSM1(amplitude, duration);
                 }
             }
             else if (playerHealth.currentHealth > 0 && playerHealth.currentHealth >= playerHealth.startingHealth + 1)
             {
                 playerHealth.TakeArmorDamage(damage);
                 if (GameMasterObject.dannyActive)
                 {
                     DannyCameraShake.InstanceD1.ShakeD1(amplitude, duration);
                 }
                 else if (GameMasterObject.strongmanActive)
                 {
                     CameraShake.InstanceSM1.ShakeSM1(amplitude, duration);
                 }
             }
         }
         if (decoyLife != null)
         {
             //Debug.Log ("gotlife");
             decoyLife.shots++;
         }
         if (timerCheckHealth != null)
         {
             timerCheckHealth.TakeDamage(15);
         }
     }
 }
Exemplo n.º 6
0
 public void Attack()
 {
     if (takeDamage)
     {
         if (playerHealth != null)
         {
             if (HUDHealthScript.timer > 5)
             {
                 HUDHealthScript.timer = 0;
             }
             if (playerHealth.currentHealth > 0 && playerHealth.currentHealth <= playerHealth.startingHealth)
             {
                 playerHealth.TakeDamage(damage);
             }
             else if (playerHealth.currentHealth > 0 && playerHealth.currentHealth >= playerHealth.startingHealth + 1)
             {
                 playerHealth.TakeArmorDamage(damage);
             }
         }
     }
 }
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Boundary")
        {
            Destroy(gameObject);
        }


        if (other.tag == "Player1")
        {
            player1.TakeDamage(10);

            Destroy(gameObject);
        }



        if (other.tag == "Player1Shot")
        {
            Instantiate(explosion, transform.position, transform.rotation);
            Destroy(gameObject);
        }
    }
    void Update()
    {
        RaycastHit hit;

        if (timer > 0)
        {
            timer -= Time.deltaTime;
            Collider[] cols = Physics.OverlapSphere(transform.position, 15f, myMask);
            for (int i = 0; i < cols.Length; i++)
            {
                Rigidbody targetRigidBody = cols [i].GetComponent <Rigidbody> ();

                if (!targetRigidBody)
                {
                    AllyDroneScript allyDrone = cols[i].GetComponentInParent <AllyDroneScript>();
                    if (allyDrone != null)
                    {
                        allyDrone.currentPower -= damage;
                    }
                    continue;
                }
                targetRigidBody.AddExplosionForce(m_ExplosionForce, transform.position, m_ExplosionRadius, 3f, ForceMode.Impulse);

                if (targetRigidBody != null)
                {
                    PlayerHealth1 playerHealth = targetRigidBody.GetComponent <PlayerHealth1> ();
                    if (playerHealth != null)
                    {
//						Debug.Log ("Reached It");
                        playerHealth.TakeDamage(damage);
                        playerHealth = null;
                        return;
                    }
                }
            }
        }
    }
Exemplo n.º 9
0
    void OnCollisionEnter(Collision other)
    {
//		Debug.Log (other.collider.tag);
        if (other.gameObject.tag == "Enemy")
        {
            EnemyHealth1 enemyHealth = other.gameObject.GetComponent <EnemyHealth1>();
            if (enemyHealth != null)
            {
                enemyHealth.TakeDamage(attackDamage * attackBoost, other.transform.position);
                Instantiate(explosion, transform.position, transform.rotation);
                destroyThis = true;
            }
        }
        else if (other.gameObject.tag == "Player")
        {
            PlayerHealth1 playerHealth = other.gameObject.GetComponent <PlayerHealth1>();
            if (playerHealth != null)
            {
                playerHealth.TakeDamage(attackDamage * attackBoost);
                if (GameMasterObject.dannyActive)
                {
                    DannyCameraShake.InstanceD1.ShakeD1(amplitude, duration);
                }
                else if (GameMasterObject.strongmanActive)
                {
                    CameraShake.InstanceSM1.ShakeSM1(amplitude, duration);
                }
                HUDHealthScript.timer = 0;
                Instantiate(explosion, transform.position, transform.rotation);
                destroyThis = true;
            }
        }
        else if (other.gameObject.tag == "Body")
        {
            EnemyHealth1 enemyHealth = other.gameObject.GetComponentInParent <EnemyHealth1>();
            if (enemyHealth != null)
            {
                enemyHealth.TakeDamage(attackDamage * attackBoost, other.transform.position);
                Instantiate(explosion, transform.position, transform.rotation);
                destroyThis = true;
            }

            BlockCharacterLife blockLife = other.gameObject.GetComponent <BlockCharacterLife> ();
            if (blockLife != null)
            {
                blockLife.shots += 75;
            }
            BlockCharacterLife blockLife2 = other.gameObject.GetComponentInParent <BlockCharacterLife> ();
            if (blockLife2 != null)
            {
                blockLife2.shots += 75;
            }
            destroyThis = true;
        }
        else if (other.collider.tag == "Body")
        {
            Debug.Log(other.collider.tag);
            EnemyHealth1 enemyHealth = other.gameObject.GetComponentInParent <EnemyHealth1>();
            if (enemyHealth != null)
            {
                enemyHealth.TakeDamage(attackDamage * attackBoost, other.transform.position);
                Instantiate(explosion, transform.position, transform.rotation);
                destroyThis = true;
            }

            BlockCharacterLife blockLife = other.gameObject.GetComponent <BlockCharacterLife> ();
            if (blockLife != null)
            {
                blockLife.shots += 75;
            }
            BlockCharacterLife blockLife2 = other.gameObject.GetComponentInParent <BlockCharacterLife> ();
            if (blockLife2 != null)
            {
                blockLife2.shots += 75;
            }
            destroyThis = true;
        }
        else if (other.collider.tag == "Head")
        {
            EnemyHealth1 enemyHealth = other.gameObject.GetComponentInParent <EnemyHealth1>();
            if (enemyHealth != null)
            {
                enemyHealth.TakeDamage(attackDamage * attackBoost, other.transform.position);
                Instantiate(explosion, transform.position, transform.rotation);
                destroyThis = true;
            }
            BlockCharacterLife blockLife = other.gameObject.GetComponent <BlockCharacterLife> ();
            if (blockLife != null)
            {
                blockLife.shots += 150;
            }
            BlockCharacterLife blockLife2 = other.gameObject.GetComponentInParent <BlockCharacterLife> ();
            if (blockLife2 != null)
            {
                blockLife2.shots += 150;
            }
            destroyThis = true;
        }
        else if (other.collider.tag == "Arms")
        {
            EnemyHealth1 enemyHealth = other.gameObject.GetComponentInParent <EnemyHealth1>();
            if (enemyHealth != null)
            {
                enemyHealth.TakeDamage(attackDamage * attackBoost, other.transform.position);
                Instantiate(explosion, transform.position, transform.rotation);
                destroyThis = true;
            }
            BlockCharacterLife blockLife = other.gameObject.GetComponent <BlockCharacterLife> ();
            if (blockLife != null)
            {
                blockLife.shots += 10;
            }
            BlockCharacterLife blockLife2 = other.gameObject.GetComponentInParent <BlockCharacterLife> ();
            if (blockLife2 != null)
            {
                blockLife2.shots += 10;
            }
            destroyThis = true;
        }
        else if (other.collider.tag == "Target Practice")
        {
            CauseDamage        causeD  = other.collider.transform.GetComponent <CauseDamage>();
            CauseDamageDestroy causeDD = other.gameObject.GetComponentInParent <CauseDamageDestroy>();

            if (causeD.addPoints >= 125 && causeD.addPoints <= 400)
            {
                HUDScoreText.currentScore += 125;
            }
            if (causeD.addPoints >= 401 && causeD.addPoints <= 1001)
            {
                HUDScoreText.currentScore += 1000;
            }
            else if (causeD.addPoints >= 100 && causeD.addPoints <= 124)
            {
                HUDScoreText.currentScore += 100;
            }
            else if (causeD.addPoints >= 26 && causeD.addPoints <= 99)
            {
                HUDScoreText.currentScore += 50;
            }
            else if (causeD.addPoints >= 6 && causeD.addPoints <= 25)
            {
                HUDScoreText.currentScore += 25;
            }
            else if (causeD.addPoints >= 2 && causeD.addPoints <= 5)
            {
                HUDScoreText.currentScore += 5;
            }
            else if (causeD.addPoints >= 1 && causeD.addPoints <= 2)
            {
                HUDScoreText.currentScore += 1;
            }
            causeDD.shots++;
            destroyThis = true;
        }
        else if (other.collider.tag == "Poppy")
        {
            PoppyLife poppyLife = other.gameObject.GetComponent <PoppyLife> ();
            if (poppyLife != null)
            {
                poppyLife.TakeDamage(attackDamage);
            }
            destroyThis = true;
        }
        else if (other.collider.tag == "Bobby")
        {
            PoppyLife poppyLife = other.gameObject.GetComponent <PoppyLife> ();
            if (poppyLife != null)
            {
                poppyLife.TakeDamage(attackDamage * 2);
            }
            destroyThis = true;
        }
        else if (other.collider.tag == "Legs")
        {
            EnemyHealth1 enemyHealth = other.gameObject.GetComponentInParent <EnemyHealth1>();
            if (enemyHealth != null)
            {
                enemyHealth.TakeDamage(attackDamage * attackBoost, other.transform.position);
                Instantiate(explosion, transform.position, transform.rotation);
                destroyThis = true;
            }
            BlockCharacterLife blockLife = other.gameObject.GetComponent <BlockCharacterLife> ();
            if (blockLife != null)
            {
                blockLife.shots += 10;
            }
            BlockCharacterLife blockLife2 = other.gameObject.GetComponentInParent <BlockCharacterLife> ();
            if (blockLife2 != null)
            {
                blockLife2.shots += 10;
            }
            destroyThis = true;
        }
        else if (other.gameObject.tag == "Shield")
        {
            Destroy(this.gameObject);
            Instantiate(explosion, transform.position, transform.rotation);
        }
        else
        {
            Destroy(this.gameObject);
//			Instantiate (explosion, transform.position, transform.rotation);
        }
        //Destroy (this.gameObject);
    }