private void OnTriggerEnter(Collider other)
    {
        Collider[] colliders = Physics.OverlapSphere(transform.position, m_ExplosionRadius, m_HitMask);

        for (int i = 0; i < colliders.Length; i++)
        {
            Rigidbody targetRigidBody = colliders[i].GetComponentInParent <Rigidbody>();

            if (!targetRigidBody)
            {
                continue;
            }
            targetRigidBody.AddExplosionForce(m_ExplosionForce, transform.position, m_ExplosionRadius);

            float damage = CalculateDamage(targetRigidBody.position);
            if (targetRigidBody == null)
            {
                BlockCharacterLife causeDDD = targetRigidBody.GetComponentInParent <BlockCharacterLife>();
                if (causeDDD != null)
                {
                    causeDDD.shots += (int)damage;
                }
            }
            else
            {
                targetRigidBody.GetComponentInParent <Rigidbody> ().AddExplosionForce(m_ExplosionForce, transform.position, m_ExplosionRadius, 5.9f, ForceMode.Impulse);

                CauseDamageDestroy causeDD = targetRigidBody.GetComponentInParent <CauseDamageDestroy>();
                if (causeDD != null)
                {
                    causeDD.shots += (int)damage;
                }
                BlockCharacterLife causeDDDD = targetRigidBody.GetComponentInParent <BlockCharacterLife>();
                if (causeDDDD != null)
                {
                    causeDDDD.shots += (int)damage;
                }
                BlockCharacterLife causeNinja = targetRigidBody.GetComponent <BlockCharacterLife>();
                if (causeNinja != null)
                {
                    causeNinja.shots += (int)damage;
                }
                PoppyLife popLife = targetRigidBody.GetComponent <PoppyLife> ();
                if (popLife != null)
                {
                    popLife.shots += (int)damage;
                }
                EnemyHealth1 enemyHealth = targetRigidBody.GetComponentInParent <EnemyHealth1> ();
                if (enemyHealth != null)
                {
                    enemyHealth.TakeDamage((int)(damage * damageBooster), targetRigidBody.transform.position);
                }
            }
        }
//		m_ExplosionParticles.transform.transform.parent = null;
//		m_ExplosionParticles.Play ();
//		m_ExplosionAudio.Play ();
//		Destroy (m_ExplosionParticles.gameObject, m_ExplosionParticles.duration);
        Destroy(gameObject);
    }
Exemplo n.º 2
0
    //public GameObject explosion;

    void OnTriggerEnter(Collider gotEm)
    {
        if (gotEm)
        {
            Collider[] colliders = Physics.OverlapSphere(transform.position, radius);

            foreach (Collider c in colliders)
            {
                if (c.GetComponent <Rigidbody> () == null)
                {
                    continue;
                }

                c.GetComponent <Rigidbody> ().AddExplosionForce(force, transform.position, radius, 5.9f, ForceMode.Impulse);
            }

            foreach (Collider c in colliders)
            {
                if (c.GetComponentInParent <Rigidbody> () == null)
                {
                    BlockCharacterLife causeDDD = c.GetComponentInParent <BlockCharacterLife>();
                    if (causeDDD != null)
                    {
                        causeDDD.shots += 6;
                    }
                }
                else
                {
                    c.GetComponentInParent <Rigidbody> ().AddExplosionForce(force, transform.position, radius, 5.9f, ForceMode.Impulse);

                    CauseDamageDestroy causeDD = c.GetComponentInParent <CauseDamageDestroy>();
                    if (causeDD != null)
                    {
                        causeDD.shots += 30;
                    }
                    BlockCharacterLife causeDDDD = c.GetComponentInParent <BlockCharacterLife>();
                    if (causeDDDD != null)
                    {
                        causeDDDD.shots += 6;
                    }
                    PoppyLife popLife = c.GetComponent <PoppyLife> ();
                    if (popLife != null)
                    {
                        popLife.shots += 10;
                    }
                    EnemyHealth1 enemyHealth = c.GetComponentInParent <EnemyHealth1> ();
                    if (enemyHealth != null)
                    {
                        enemyHealth.TakeDamage(damage * damageBooster, c.transform.position);
                    }
                }
                //continue;
            }

            //Instantiate(explosion, transform.position, Quaternion.identity);

            Destroy(this.gameObject);
        }
    }
Exemplo n.º 3
0
    void FixedUpdate()
    {
//		Debug.Log (fireRotation);
        if (shooting)
        {
            fireTime += Time.deltaTime;

            shooting = false;

            RaycastHit hit;

            Vector3 fireDirection = bulletSpawn.forward;

            fireRotation = Quaternion.LookRotation(fireDirection);

            Quaternion randomRotation = Random.rotation;

            float currentSpread = Mathf.Lerp(0.0f, maxBulletSpreadAngle, fireTime / timeToSpread);

            fireRotation = Quaternion.RotateTowards(fireRotation, randomRotation, Random.Range(0.0f, currentSpread));
            if (Physics.Raycast(bulletSpawn.position, fireRotation * Vector3.forward, out hit, distance, myLayMask))
            {
                if (hit.transform.tag == "Cover")
                {
                    impacts[currentImpact].transform.position = hit.point;
                    impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                    if (++currentImpact >= maxImpacts)
                    {
                        currentImpact = 0;
                    }
                }

                if (hit.transform.tag == "Environment")
                {
                    impacts[currentImpact].transform.position = hit.point;
                    impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                    if (++currentImpact >= maxImpacts)
                    {
                        currentImpact = 0;
                    }
                }

                if (hit.transform.tag == "Target Practice")
                {
                    impacts[currentImpact].transform.position = hit.point;
                    impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                    if (++currentImpact >= maxImpacts)
                    {
                        currentImpact = 0;
                    }

                    CauseDamage        causeD  = hit.transform.GetComponent <CauseDamage>();
                    CauseDamageDestroy causeDD = hit.transform.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++;
                }

                else if (hit.collider.tag == "TutorialDoors")
                {
                    impacts[currentImpact].transform.position = hit.point;
                    impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                    if (++currentImpact >= maxImpacts)
                    {
                        currentImpact = 0;
                    }
                    CauseDamageDestroy causeDD = hit.transform.GetComponentInParent <CauseDamageDestroy>();
                    if (causeDD != null)
                    {
                        causeDD.shots++;
                    }
                }

                else if (hit.collider.tag == "Head")
                {
                    GameMasterObject.totalHeadShots++;
                    GameMasterObject.totalHitShots++;
                    impacts[currentImpact].transform.position = hit.point;
                    impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                    if (++currentImpact >= maxImpacts)
                    {
                        currentImpact = 0;
                    }
                    BlockCharacterLife blockCharLife = hit.transform.GetComponentInParent <BlockCharacterLife>();
                    if (blockCharLife != null)
                    {
                        blockCharLife.shots  += 7;
                        blockCharLife.gotShot = true;
                    }

                    EnemyHealth1 enemyHealth = hit.collider.GetComponentInParent <EnemyHealth1> ();
                    if (enemyHealth != null)
                    {
                        enemyHealth.TakeDamage(headDamage * attackBooster, hit.transform.position);
                        //hit.rigidbody.AddForceAtPosition(new Vector3(Random.Range(1,10), Random.Range(1, 10), Random.Range(1, 10)) * 10, hit.transform.position);
                    }
                }

                else if (hit.collider.tag == "Doors")
                {
                    //hit.rigidbody.AddForceAtPosition(new Vector3(Random.Range(1,10), Random.Range(1, 10), Random.Range(1, 10)) * 100, hit.transform.position);
                }

                else if (hit.collider.tag == "Body")
                {
                    GameMasterObject.totalBodyShots++;
                    GameMasterObject.totalHitShots++;
                    impacts[currentImpact].transform.position = hit.point;
                    impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                    if (++currentImpact >= maxImpacts)
                    {
                        currentImpact = 0;
                    }
                    BlockCharacterLife blockCharLife = hit.transform.GetComponentInParent <BlockCharacterLife>();
                    if (blockCharLife != null)
                    {
                        blockCharLife.shots  += 4;
                        blockCharLife.gotShot = true;
                    }

                    EnemyHealth1 enemyHealth = hit.collider.GetComponentInParent <EnemyHealth1> ();
                    if (enemyHealth != null)
                    {
                        enemyHealth.TakeDamage(bodyDamage * attackBooster, hit.transform.position);
                        //hit.rigidbody.AddForceAtPosition(new Vector3(Random.Range(1,10), Random.Range(1, 10), Random.Range(1, 10)) * 10, hit.transform.position);
                    }
                }
                else if (hit.collider.tag == "Weapon")
                {
                    GameMasterObject.totalHitShots++;
                    impacts[currentImpact].transform.position = hit.point;
                    impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                    if (++currentImpact >= maxImpacts)
                    {
                        currentImpact = 0;
                    }
                    RocketDamage rocketDamage = hit.collider.GetComponent <RocketDamage> ();
                    if (rocketDamage != null)
                    {
                        rocketDamage.TakeDamage(3 * attackBooster);
                    }
                }

                else if (hit.collider.tag == "Poppy")
                {
                    GameMasterObject.totalHitShots++;
                    impacts[currentImpact].transform.position = hit.point;
                    impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                    if (++currentImpact >= maxImpacts)
                    {
                        currentImpact = 0;
                    }
                    PoppyLife poppyLife = hit.collider.GetComponent <PoppyLife> ();
                    if (poppyLife != null)
                    {
                        poppyLife.TakeDamage(1);
                    }
                }

                else if (hit.collider.tag == "Bobby")
                {
                    GameMasterObject.totalHitShots++;
                    impacts[currentImpact].transform.position = hit.point;
                    impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                    if (++currentImpact >= maxImpacts)
                    {
                        currentImpact = 0;
                    }
                    PoppyLife poppyLife = hit.collider.GetComponent <PoppyLife> ();
                    if (poppyLife != null)
                    {
                        poppyLife.TakeDamage(75);
                    }
                    PoppyLife poppyLife2 = hit.collider.GetComponentInParent <PoppyLife> ();
                    if (poppyLife2 != null)
                    {
                        poppyLife2.TakeDamage(75);
                    }
                }
                else if (hit.collider.tag == "Mask")
                {
                    GameMasterObject.totalHitShots++;
                    impacts[currentImpact].transform.position = hit.point;
                    impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                    if (++currentImpact >= maxImpacts)
                    {
                        currentImpact = 0;
                    }
                    TalkingHeadLife headLift = hit.collider.GetComponent <TalkingHeadLife> ();
                    if (headLift != null)
                    {
                        headLift.TakeDamage(75);
                    }
                }
                else if (hit.collider.tag == "Legs")
                {
                    GameMasterObject.totalLegShots++;
                    GameMasterObject.totalHitShots++;
                    impacts[currentImpact].transform.position = hit.point;
                    impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                    if (++currentImpact >= maxImpacts)
                    {
                        currentImpact = 0;
                    }
                    BlockCharacterLife blockCharlife = hit.transform.GetComponentInParent <BlockCharacterLife>();
                    if (blockCharlife != null)
                    {
                        blockCharlife.shots += 3;
                    }

                    EnemyHealth1 enemyHealth = hit.collider.GetComponentInParent <EnemyHealth1> ();
                    if (enemyHealth != null)
                    {
                        enemyHealth.TakeDamage(legDamage * attackBooster, hit.transform.position);
                        //hit.rigidbody.AddForceAtPosition(new Vector3(Random.Range(1,10), Random.Range(1, 10), Random.Range(1, 10)) * 10, hit.transform.position);
                    }
                }

                else if (hit.collider.tag == "Arms")
                {
                    GameMasterObject.totalArmShots++;
                    GameMasterObject.totalHitShots++;
                    impacts[currentImpact].transform.position = hit.point;
                    impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                    if (++currentImpact >= maxImpacts)
                    {
                        currentImpact = 0;
                    }
                    BlockCharacterLife blockCharlife = hit.transform.GetComponentInParent <BlockCharacterLife>();
                    if (blockCharlife != null)
                    {
                        blockCharlife.shots += 2;
                    }

                    EnemyHealth1 enemyHealth = hit.collider.GetComponentInParent <EnemyHealth1> ();
                    if (enemyHealth != null)
                    {
                        enemyHealth.TakeDamage(armDamage * attackBooster, hit.transform.position);
                        //hit.rigidbody.AddForceAtPosition(new Vector3(Random.Range(1,10), Random.Range(1, 10), Random.Range(1, 10)) * 10, hit.transform.position);
                    }
                }
            }
        }
    }
Exemplo n.º 4
0
    void OnTriggerEnter(Collider gotEm)
    {
        if (gotEm && !hitYet)
        {
            //sounds.PlayOneShot (groundHit);
            CameraShake.InstanceSM1.ShakeSM1(amplitude, duration);
            Collider[] cols = Physics.OverlapSphere(transform.position, radius /*, m_HitMask*/);

            for (int i = 0; i < cols.Length; i++)
            {
                Rigidbody targetRigidBody = cols[i].GetComponentInParent <Rigidbody>();

                if (!targetRigidBody)
                {
                    //continue;
                    BlockCharacterLife causeDDD = cols[i].GetComponentInParent <BlockCharacterLife>();
                    if (causeDDD != null)
                    {
                        causeDDD.shots += damage;
                    }
                    continue;
                }
                targetRigidBody.AddExplosionForce(force, transform.position, radius);

                if (targetRigidBody != null)
                {
                    targetRigidBody.GetComponentInParent <Rigidbody> ().AddExplosionForce(force, transform.position, radius, 5.9f, ForceMode.Impulse);
//					impacts[currentImpact].transform.position = targetRigidBody.transform.position;
//					impacts[currentImpact].GetComponent<ParticleSystem>().Play();
//
//					if(++currentImpact >= maxImpacts)
//					{
//						currentImpact = 0;
//					}

                    CauseDamageDestroy causeDD = targetRigidBody.GetComponentInParent <CauseDamageDestroy>();
                    if (causeDD != null)
                    {
                        causeDD.shots += damage;
                    }
                    RocketDamage rocketDamage = targetRigidBody.GetComponent <RocketDamage> ();
                    if (rocketDamage != null)
                    {
                        rocketDamage.shots += damage;
                    }
                    BlockCharacterLife causeDDDD = targetRigidBody.GetComponentInParent <BlockCharacterLife>();
                    if (causeDDDD != null)
                    {
                        causeDDDD.shots += damage;
                    }
                    BlockCharacterLife causeNinja = targetRigidBody.GetComponent <BlockCharacterLife>();
                    if (causeNinja != null)
                    {
                        causeNinja.shots += damage;
                    }
                    PoppyLife popLife = targetRigidBody.GetComponent <PoppyLife> ();
                    if (popLife != null)
                    {
                        popLife.TakeDamage(365 * damageBooster);
                    }
                    TalkingHeadLife headLife = targetRigidBody.GetComponent <TalkingHeadLife> ();
                    if (headLife != null)
                    {
                        headLife.TakeDamage(365 * damageBooster);
                    }
                    EnemyHealth1 enemyHealth = targetRigidBody.GetComponentInParent <EnemyHealth1> ();
                    if (enemyHealth != null)
                    {
                        enemyHealth.TakeDamage(damage * damageBooster, cols[i].transform.position);
                    }
                }
            }
            hitYet = true;

            Instantiate(impactToUse, instanPoint.position, Quaternion.identity);
            this.gameObject.SetActive(false);
        }
    }
Exemplo n.º 5
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);
    }
Exemplo n.º 6
0
 void Awake()
 {
     myTransform = transform;
     poppylife   = GetComponent <PoppyLife>();
     anim        = GetComponent <Animator>();
 }
Exemplo n.º 7
0
    void FixedUpdate()
    {
        if (shooting)
        {
            shooting = false;

            RaycastHit hit;

            if (Physics.Raycast(bulletSpawn.position, bulletSpawn.forward, out hit, distance, myLayerMask))
            {
//				Debug.Log (hit.collider.tag);
                if (hit.transform.tag == "Cover")
                {
                    impacts[currentImpact].transform.position = hit.point;
                    impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                    if (++currentImpact >= maxImpacts)
                    {
                        currentImpact = 0;
                    }
                }

                if (hit.transform.tag == "Environment")
                {
                    impacts[currentImpact].transform.position = hit.point;
                    impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                    if (++currentImpact >= maxImpacts)
                    {
                        currentImpact = 0;
                    }
                }

                if (hit.transform.tag == "Target Practice")
                {
                    impacts[currentImpact].transform.position = hit.point;
                    impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                    if (++currentImpact >= maxImpacts)
                    {
                        currentImpact = 0;
                    }

                    CauseDamage        causeD  = hit.transform.GetComponent <CauseDamage>();
                    CauseDamageDestroy causeDD = hit.transform.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 += 1 * attackBooster;
                }

                else if (hit.collider.tag == "TutorialDoors")
                {
                    impacts[currentImpact].transform.position = hit.point;
                    impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                    if (++currentImpact >= maxImpacts)
                    {
                        currentImpact = 0;
                    }
                    CauseDamageDestroy causeDD = hit.transform.GetComponentInParent <CauseDamageDestroy>();
                    if (causeDD != null)
                    {
                        causeDD.shots += 2 * attackBooster;
                    }
                }

                else if (hit.collider.tag == "Head")
                {
                    GameMasterObject.totalHeadShots++;
                    GameMasterObject.totalHitShots++;
                    impacts[currentImpact].transform.position = hit.point;
                    impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                    if (++currentImpact >= maxImpacts)
                    {
                        currentImpact = 0;
                    }
                    BlockCharacterLife blockCharLife = hit.transform.GetComponentInParent <BlockCharacterLife>();
                    if (blockCharLife != null)
                    {
                        blockCharLife.shots  += 15 * attackBooster;
                        blockCharLife.gotShot = true;
                    }

                    EnemyHealth1 enemyHealth = hit.collider.GetComponentInParent <EnemyHealth1> ();
                    if (enemyHealth != null)
                    {
                        enemyHealth.TakeDamage(headDamage * attackBooster, hit.transform.position);
                        //hit.rigidbody.AddForceAtPosition(new Vector3(Random.Range(1,10), Random.Range(1, 10), Random.Range(1, 10)) * 10, hit.transform.position);
                    }
                }
                else if (hit.collider.tag == "Weapon")
                {
                    GameMasterObject.totalHitShots++;
                    impacts[currentImpact].transform.position = hit.point;
                    impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                    if (++currentImpact >= maxImpacts)
                    {
                        currentImpact = 0;
                    }
                    RocketDamage rocketDamage = hit.collider.GetComponent <RocketDamage> ();
                    if (rocketDamage != null)
                    {
                        rocketDamage.TakeDamage(6 * attackBooster);
                    }
                }

                else if (hit.collider.tag == "Poppy")
                {
                    GameMasterObject.totalHitShots++;
                    impacts[currentImpact].transform.position = hit.point;
                    impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                    if (++currentImpact >= maxImpacts)
                    {
                        currentImpact = 0;
                    }
                    PoppyLife poppyLife = hit.collider.GetComponent <PoppyLife> ();
                    if (poppyLife != null)
                    {
                        poppyLife.TakeDamage(2 * attackBooster);
                    }
                }

                else if (hit.collider.tag == "Bobby")
                {
                    GameMasterObject.totalHitShots++;
                    impacts[currentImpact].transform.position = hit.point;
                    impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                    if (++currentImpact >= maxImpacts)
                    {
                        currentImpact = 0;
                    }
                    PoppyLife poppyLife = hit.collider.GetComponent <PoppyLife> ();
                    if (poppyLife != null)
                    {
                        poppyLife.TakeDamage(125 * attackBooster);
                    }
                    PoppyLife poppyLife2 = hit.collider.GetComponentInParent <PoppyLife> ();
                    if (poppyLife2 != null)
                    {
                        poppyLife2.TakeDamage(125 * attackBooster);
                    }
                }
                else if (hit.collider.tag == "Mask")
                {
                    GameMasterObject.totalHitShots++;
                    impacts[currentImpact].transform.position = hit.point;
                    impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                    if (++currentImpact >= maxImpacts)
                    {
                        currentImpact = 0;
                    }
                    TalkingHeadLife headLift = hit.collider.GetComponent <TalkingHeadLife> ();
                    if (headLift != null)
                    {
                        headLift.TakeDamage(75 * attackBooster);
                    }
                }

                else if (hit.collider.tag == "Body")
                {
                    GameMasterObject.totalBodyShots++;
                    GameMasterObject.totalHitShots++;
                    impacts[currentImpact].transform.position = hit.point;
                    impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                    if (++currentImpact >= maxImpacts)
                    {
                        currentImpact = 0;
                    }
                    BlockCharacterLife blockCharLife = hit.collider.transform.GetComponentInParent <BlockCharacterLife>();
                    if (blockCharLife != null)
                    {
                        blockCharLife.shots  += 5 * attackBooster;
                        blockCharLife.gotShot = true;
                    }

                    EnemyHealth1 enemyHealth = hit.collider.GetComponentInParent <EnemyHealth1> ();
                    if (enemyHealth != null)
                    {
                        enemyHealth.TakeDamage(bodyDamage * attackBooster, hit.transform.position);
                        //other.rigidbody.AddForceAtPosition(Vector3.forward * 10, other.transform.position);
                    }
                }

                else if (hit.collider.tag == "Legs")
                {
                    GameMasterObject.totalLegShots++;
                    GameMasterObject.totalHitShots++;
                    impacts[currentImpact].transform.position = hit.point;
                    impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                    if (++currentImpact >= maxImpacts)
                    {
                        currentImpact = 0;
                    }
                    BlockCharacterLife blockCharLife = hit.transform.GetComponentInParent <BlockCharacterLife>();
                    if (blockCharLife != null)
                    {
                        blockCharLife.shots += 4 * attackBooster;
                    }

                    EnemyHealth1 enemyHealth = hit.collider.GetComponentInParent <EnemyHealth1> ();
                    if (enemyHealth != null)
                    {
                        enemyHealth.TakeDamage(legDamage * attackBooster, hit.transform.position);
                        //other.rigidbody.AddForceAtPosition(Vector3.forward * 10, other.transform.position);
                    }
                }

                else if (hit.collider.tag == "Arms")
                {
                    GameMasterObject.totalArmShots++;
                    GameMasterObject.totalHitShots++;
                    impacts[currentImpact].transform.position = hit.point;
                    impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                    if (++currentImpact >= maxImpacts)
                    {
                        currentImpact = 0;
                    }
                    BlockCharacterLife blockCharLife = hit.transform.GetComponentInParent <BlockCharacterLife>();
                    if (blockCharLife != null)
                    {
                        blockCharLife.shots += 3 * attackBooster;
                    }

                    EnemyHealth1 enemyHealth = hit.collider.GetComponentInParent <EnemyHealth1> ();
                    if (enemyHealth != null)
                    {
                        enemyHealth.TakeDamage(armDamage * attackBooster, hit.transform.position);
                        //other.rigidbody.AddForceAtPosition(Vector3.forward * 10, other.transform.position);
                    }
                }
            }
        }
    }
Exemplo n.º 8
0
    void OnCollisionEnter(Collision other)
    {
//		Debug.Log (other.collider.tag);
        if (other.collider.tag == "Enemy")
        {
            EnemyHealth1 enemyHealth = other.gameObject.GetComponent <EnemyHealth1>();
            if (enemyHealth != null)
            {
                enemyHealth.TakeDamage(attackDamage * attackBoost, other.transform.position);
                Instantiate(explosion, transform.position, transform.rotation);
            }
        }
        if (other.collider.tag == "Body")
        {
//			Debug.Log ("body");
            EnemyHealth1 enemyHealth = other.collider.GetComponentInParent <EnemyHealth1>();
            if (enemyHealth != null)
            {
                enemyHealth.TakeDamage(attackDamage * attackBoost, other.transform.position);
                Instantiate(explosion, transform.position, transform.rotation);
            }

            BlockCharacterLife blockLife = other.gameObject.GetComponentInParent <BlockCharacterLife> ();
            if (blockLife != null)
            {
//				Debug.Log ("notnull2");
                blockLife.shots += 75;
            }
            BlockCharacterLife blockLife2 = other.gameObject.GetComponentInParent <BlockCharacterLife> ();
            if (blockLife2 != null)
            {
//				Debug.Log ("notnull2");
                blockLife2.shots += 75;
            }
        }
        else if (other.collider.tag == "Head")
        {
            EnemyHealth1 enemyHealth = other.collider.GetComponentInParent <EnemyHealth1>();
            if (enemyHealth != null)
            {
                enemyHealth.TakeDamage(attackDamage * attackBoost, other.transform.position);
                Instantiate(explosion, transform.position, transform.rotation);
            }
            BlockCharacterLife blockLife = other.gameObject.GetComponentInParent <BlockCharacterLife> ();
            if (blockLife != null)
            {
                blockLife.shots += 150;
            }
            BlockCharacterLife blockLife2 = other.gameObject.GetComponentInParent <BlockCharacterLife> ();
            if (blockLife2 != null)
            {
                blockLife2.shots += 150;
            }
        }
        else if (other.collider.tag == "Arms")
        {
            EnemyHealth1 enemyHealth = other.collider.GetComponentInParent <EnemyHealth1>();
            if (enemyHealth != null)
            {
                enemyHealth.TakeDamage(attackDamage * attackBoost, other.transform.position);
                Instantiate(explosion, transform.position, transform.rotation);
            }
            BlockCharacterLife blockLife = other.gameObject.GetComponentInParent <BlockCharacterLife> ();
            if (blockLife != null)
            {
                blockLife.shots += 10;
            }
            BlockCharacterLife blockLife2 = other.gameObject.GetComponentInParent <BlockCharacterLife> ();
            if (blockLife2 != null)
            {
                blockLife2.shots += 10;
            }
        }
        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++;
        }
        else if (other.collider.tag == "Poppy")
        {
            PoppyLife poppyLife = other.gameObject.GetComponent <PoppyLife> ();
            if (poppyLife != null)
            {
                poppyLife.TakeDamage(attackDamage);
            }
        }
        else if (other.collider.tag == "Bobby")
        {
            PoppyLife poppyLife = other.gameObject.GetComponent <PoppyLife> ();
            if (poppyLife != null)
            {
                poppyLife.TakeDamage(attackDamage * 2);
            }
        }
        else if (other.collider.tag == "Legs")
        {
            EnemyHealth1 enemyHealth = other.collider.GetComponentInParent <EnemyHealth1>();
            if (enemyHealth != null)
            {
                enemyHealth.TakeDamage(attackDamage * attackBoost, other.transform.position);
                Instantiate(explosion, transform.position, transform.rotation);
            }
            BlockCharacterLife blockLife = other.gameObject.GetComponentInParent <BlockCharacterLife> ();
            if (blockLife != null)
            {
                blockLife.shots += 10;
            }
            BlockCharacterLife blockLife2 = other.gameObject.GetComponentInParent <BlockCharacterLife> ();
            if (blockLife2 != null)
            {
                blockLife2.shots += 10;
            }
        }
        else if (other.gameObject.tag == "Cover")
        {
            Destroy(this.gameObject);
            Instantiate(explosion, transform.position, transform.rotation);
        }
        else
        {
            Destroy(this.gameObject);
        }
        Destroy(this.gameObject);
    }
Exemplo n.º 9
0
	void FixedUpdate()
	{
		if(firing)
		{
			muzzleFlash1.SetActive (false);
			muzzleFlash2.SetActive (false);

			anim.SetTrigger("Shooting");

				fireTime += Time.deltaTime;
				
				firing = false;
				
				RaycastHit hit;
				
				Vector3 fireDirection = bulletSpawn1.forward;
				
				Quaternion fireRotation = Quaternion.LookRotation(fireDirection);
				
				Quaternion randomRotation = Random.rotation;
				
				float currentSpread = Mathf.Lerp(0.0f, maxBulletSpreadAngle, fireTime/timeToSpread);
				
				fireRotation = Quaternion.RotateTowards(fireRotation, randomRotation, Random.Range(0.0f, currentSpread));
				
				if (Physics.Raycast (bulletSpawn1.position, fireRotation * Vector3.forward, out hit)) 
				{		//Debug.Log(hit.collider);			
					if (hit.collider.tag == "Head") 
					{
					BlockCharacterLife causeDD = hit.transform.GetComponentInParent<BlockCharacterLife>();
					if(causeDD != null)
					{
						GunHit gunHit = new GunHit();
						gunHit.damage = damage;
						gunHit.raycastHit = hit;
						hit.collider.SendMessage("Damage", gunHit, SendMessageOptions.DontRequireReceiver);		

						causeDD.shots += 25;
					}
						EnemyHealth1 enemyHealth = hit.collider.GetComponentInParent<EnemyHealth1> ();
						if (enemyHealth != null)
						{					
							enemyHealth.TakeDamage (damage * attackBooster, hit.transform.position);
							//other.rigidbody.AddForceAtPosition(Vector3.forward * 10, other.transform.position);
						}
					}

					else if (hit.transform.tag == "Environment") 
					{
						GunHit gunHit = new GunHit();
						gunHit.damage = damageFloat;
						gunHit.raycastHit = hit;
						hit.collider.SendMessage("Damage", gunHit, SendMessageOptions.DontRequireReceiver);
						//HUDEnemyCounter.enemyCounter--;
					} 
					
					else if (hit.collider.tag == "Body") 
					{
						BlockCharacterLife causeDD = hit.transform.GetComponentInParent<BlockCharacterLife>();
						if(causeDD != null)
						{
							GunHit gunHit = new GunHit();
							gunHit.damage = damage;
							gunHit.raycastHit = hit;
							hit.collider.SendMessage("Damage", gunHit, SendMessageOptions.DontRequireReceiver);		
														
							causeDD.shots += 15;

							EnemyHealth1 enemyHealth = hit.collider.GetComponentInParent<EnemyHealth1> ();
							if (enemyHealth != null)
							{					
								enemyHealth.TakeDamage (damage * attackBooster, hit.transform.position);
								//other.rigidbody.AddForceAtPosition(Vector3.forward * 10, other.transform.position);
							}
						}
					}

					else if (hit.collider.tag == "Poppy")
					{
						PoppyLife poppyLife = hit.collider.GetComponent<PoppyLife> ();
						if(poppyLife != null)
						{
							GunHit gunHit = new GunHit();
							gunHit.damage = damage;
							gunHit.raycastHit = hit;
							hit.collider.SendMessage("Damage", gunHit, SendMessageOptions.DontRequireReceiver);		
						poppyLife.TakeDamage (2);
							//poppyLife.shots++;
						}
					}

					else if (hit.collider.tag == "Bobby")
					{
						PoppyLife poppyLife = hit.collider.GetComponent<PoppyLife> ();
						if(poppyLife != null)
						{
							GunHit gunHit = new GunHit();
							gunHit.damage = damage;
							gunHit.raycastHit = hit;
							hit.collider.SendMessage("Damage", gunHit, SendMessageOptions.DontRequireReceiver);		
						poppyLife.TakeDamage (150);
							//poppyLife.shots += 75;
						}
					}
					
					else if (hit.collider.tag == "Legs") 
					{
						BlockCharacterLife causeDD = hit.transform.GetComponentInParent<BlockCharacterLife>();
						if(causeDD != null)
						{
							GunHit gunHit = new GunHit();
							gunHit.damage = damage;
							gunHit.raycastHit = hit;
							hit.collider.SendMessage("Damage", gunHit, SendMessageOptions.DontRequireReceiver);		
														
							causeDD.shots += 10;
							EnemyHealth1 enemyHealth = hit.collider.GetComponentInParent<EnemyHealth1> ();
							if (enemyHealth != null)
							{					
								enemyHealth.TakeDamage (damage * attackBooster, hit.transform.position);
								//other.rigidbody.AddForceAtPosition(Vector3.forward * 10, other.transform.position);
							}
						}
					}
					
					else if (hit.collider.tag == "Arms") 
					{
						BlockCharacterLife causeDD = hit.transform.GetComponentInParent<BlockCharacterLife>();
						if(causeDD != null)
						{
							GunHit gunHit = new GunHit();
							gunHit.damage = damage;
							gunHit.raycastHit = hit;
							hit.collider.SendMessage("Damage", gunHit, SendMessageOptions.DontRequireReceiver);		
														
							causeDD.shots += 10;
							EnemyHealth1 enemyHealth = hit.collider.GetComponentInParent<EnemyHealth1> ();
							if (enemyHealth != null)
							{					
								enemyHealth.TakeDamage (damage * attackBooster, hit.transform.position);
								//other.rigidbody.AddForceAtPosition(Vector3.forward * 10, other.transform.position);
							}
						}
					}
					
					/*impacts[currentImpact].transform.position = hit.point;
				impacts[currentImpact].GetComponent<ParticleSystem>().Play();

				if(++currentImpact >= maxImpacts)
				{
					currentImpact = 0;
				}*/				
				}
			}
	}
Exemplo n.º 10
0
    void FixedUpdate()
    {
        if (shooting)
        {
            shooting = false;

            for (int i = 0; i < shotFragments; i++)
            {
                RaycastHit hit;

                Vector3 fireDirection = bulletSpawn.forward;

                Quaternion fireRotation = Quaternion.LookRotation(fireDirection);

                Quaternion randomRotation = Random.rotation;

                //float currentSpread = Mathf.Lerp (0.0f, maxBulletSpreadAngle, fireTime / timeToSpread);

                fireRotation = Quaternion.RotateTowards(fireRotation, randomRotation, Random.Range(0.0f, spreadAngle));


                if (Physics.Raycast(bulletSpawn.position, fireRotation * Vector3.forward, out hit, distance, myLayerMask))
                {
                    if (hit.transform.tag == "Cover")
                    {
                        impacts[currentImpact].transform.position = hit.point;
                        impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                        if (++currentImpact >= maxImpacts)
                        {
                            currentImpact = 0;
                        }
                    }

                    if (hit.transform.tag == "Environment")
                    {
                        impacts[currentImpact].transform.position = hit.point;
                        impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                        if (++currentImpact >= maxImpacts)
                        {
                            currentImpact = 0;
                        }
                    }

                    if (hit.transform.tag == "Target Practice")
                    {
                        impacts[currentImpact].transform.position = hit.point;
                        impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                        if (++currentImpact >= maxImpacts)
                        {
                            currentImpact = 0;
                        }
                        CauseDamage        causeD  = hit.transform.GetComponent <CauseDamage>();
                        CauseDamageDestroy causeDD = hit.transform.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++;
                    }

                    else if (hit.collider.tag == "TutorialDoors")
                    {
                        impacts[currentImpact].transform.position = hit.point;
                        impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                        if (++currentImpact >= maxImpacts)
                        {
                            currentImpact = 0;
                        }
                        CauseDamageDestroy causeDD = hit.transform.GetComponentInParent <CauseDamageDestroy>();
                        if (causeDD != null)
                        {
                            causeDD.shots += 2;
                        }
                    }

                    else if (hit.collider.tag == "Head")
                    {
                        GameMasterObject.totalShotGunHits++;
                        impacts[currentImpact].transform.position = hit.point;
                        impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                        if (++currentImpact >= maxImpacts)
                        {
                            currentImpact = 0;
                        }
                        BlockCharacterLife blockCharLife = hit.transform.GetComponentInParent <BlockCharacterLife>();
                        if (blockCharLife != null)
                        {
                            blockCharLife.shots += 10;
                            if (!blockCharLife.reallyGotShot)
                            {
                                blockCharLife.reallyGotShot = true;
                            }
                        }


                        EnemyHealth1 enemyHealth = hit.collider.GetComponentInParent <EnemyHealth1> ();
                        if (enemyHealth != null)
                        {
                            enemyHealth.TakeDamage(headDamage * attackBooster, hit.transform.position);
                            //hit.transform.GetComponentInParent<Rigidbody> ().AddForceAtPosition (hit.collider.transform.position - hit.point * pushForce, hit.point, ForceMode.Force);
                        }
                        //hit.collider.attachedRigidbody.AddForceAtPosition (hit.collider.transform.position - hit.point * pushForce, hit.point, ForceMode.Force);
                    }
                    else if (hit.collider.tag == "Weapon")
                    {
                        GameMasterObject.totalShotGunHits++;
                        impacts[currentImpact].transform.position = hit.point;
                        impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                        if (++currentImpact >= maxImpacts)
                        {
                            currentImpact = 0;
                        }
                        RocketDamage rocketDamage = hit.collider.GetComponent <RocketDamage> ();
                        if (rocketDamage != null)
                        {
                            rocketDamage.TakeDamage(11 * attackBooster);
                        }
                    }

                    else if (hit.collider.tag == "Poppy")
                    {
                        GameMasterObject.totalShotGunHits++;
                        impacts[currentImpact].transform.position = hit.point;
                        impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                        if (++currentImpact >= maxImpacts)
                        {
                            currentImpact = 0;
                        }
                        PoppyLife poppyLife = hit.collider.GetComponent <PoppyLife> ();
                        if (poppyLife != null)
                        {
                            poppyLife.TakeDamage(3);
                        }
                    }

                    else if (hit.collider.tag == "Bobby")
                    {
                        GameMasterObject.totalShotGunHits++;
                        impacts[currentImpact].transform.position = hit.point;
                        impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                        if (++currentImpact >= maxImpacts)
                        {
                            currentImpact = 0;
                        }
                        PoppyLife poppyLife = hit.collider.GetComponent <PoppyLife> ();
                        if (poppyLife != null)
                        {
                            poppyLife.TakeDamage(255);
                        }
                        PoppyLife poppyLife2 = hit.collider.GetComponentInParent <PoppyLife> ();
                        if (poppyLife2 != null)
                        {
                            poppyLife2.TakeDamage(255);
                        }
                    }
                    else if (hit.collider.tag == "Mask")
                    {
                        GameMasterObject.totalHitShots++;
                        impacts[currentImpact].transform.position = hit.point;
                        impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                        if (++currentImpact >= maxImpacts)
                        {
                            currentImpact = 0;
                        }
                        TalkingHeadLife headLift = hit.collider.GetComponent <TalkingHeadLife> ();
                        if (headLift != null)
                        {
                            headLift.TakeDamage(75);
                        }
                    }
                    else if (hit.collider.tag == "Body")
                    {
                        GameMasterObject.totalShotGunHits++;
                        impacts[currentImpact].transform.position = hit.point;
                        impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                        if (++currentImpact >= maxImpacts)
                        {
                            currentImpact = 0;
                        }
                        BlockCharacterLife blockCharLife = hit.collider.transform.GetComponentInParent <BlockCharacterLife>();
                        if (blockCharLife != null)
                        {
                            blockCharLife.shots += 6;
                            if (!blockCharLife.reallyGotShot)
                            {
                                blockCharLife.reallyGotShot = true;
                            }
                        }

                        EnemyHealth1 enemyHealth = hit.collider.GetComponentInParent <EnemyHealth1> ();
                        if (enemyHealth != null)
                        {
                            enemyHealth.TakeDamage(bodyDamage * attackBooster, hit.transform.position);
                            //hit.transform.GetComponentInParent<Rigidbody>().AddForceAtPosition (hit.collider.transform.position - hit.point * pushForce, hit.point, ForceMode.Force);
                        }
                        //hit.collider.attachedRigidbody.AddForceAtPosition (hit.collider.transform.position - hit.point * pushForce, hit.point, ForceMode.Force);
                    }
                    else if (hit.collider.tag == "Legs")
                    {
                        GameMasterObject.totalShotGunHits++;
                        impacts[currentImpact].transform.position = hit.point;
                        impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                        if (++currentImpact >= maxImpacts)
                        {
                            currentImpact = 0;
                        }
                        BlockCharacterLife blockCharLife = hit.transform.GetComponentInParent <BlockCharacterLife>();
                        if (blockCharLife != null)
                        {
                            blockCharLife.shots += 3;
                        }

                        EnemyHealth1 enemyHealth = hit.collider.GetComponentInParent <EnemyHealth1> ();
                        if (enemyHealth != null)
                        {
                            enemyHealth.TakeDamage(legDamage * attackBooster, hit.transform.position);
                            //hit.transform.GetComponentInParent<Rigidbody>().AddForceAtPosition (hit.collider.transform.position - hit.point * pushForce, hit.point, ForceMode.Force);
                        }
                        //hit.collider.attachedRigidbody.AddForceAtPosition (hit.collider.transform.position - hit.point * pushForce, hit.point, ForceMode.Force);
                    }
                    else if (hit.collider.tag == "Arms")
                    {
                        GameMasterObject.totalShotGunHits++;
                        impacts[currentImpact].transform.position = hit.point;
                        impacts[currentImpact].GetComponent <ParticleSystem>().Play();

                        if (++currentImpact >= maxImpacts)
                        {
                            currentImpact = 0;
                        }
                        BlockCharacterLife blockCharLife = hit.transform.GetComponentInParent <BlockCharacterLife>();
                        if (blockCharLife != null)
                        {
                            blockCharLife.shots += 2;
                            if (!blockCharLife.reallyGotShot)
                            {
                                blockCharLife.reallyGotShot = true;
                            }
                        }

                        EnemyHealth1 enemyHealth = hit.collider.GetComponentInParent <EnemyHealth1> ();
                        if (enemyHealth != null)
                        {
                            enemyHealth.TakeDamage(armDamage * attackBooster, hit.transform.position);
                            //hit.transform.GetComponentInParent<Rigidbody>().AddForceAtPosition (hit.collider.transform.position - hit.point * pushForce, hit.point, ForceMode.Force);
                        }
                        //hit.collider.attachedRigidbody.AddForceAtPosition (hit.collider.transform.position - hit.point * pushForce, hit.point, ForceMode.Force);
                    }
                }
            }
        }
    }