コード例 #1
0
ファイル: PlayerAttack.cs プロジェクト: Jyngwe/UnityLek
    void Attack()
    {
        timer = 0f;

        gunLight.enabled = true;

        gunParticles.Stop();
        gunParticles.Play();

        gunLine.enabled = true;
        gunLine.SetPosition(0, transform.position);

        shootRay.origin    = transform.position;
        shootRay.direction = -transform.right;

        if (Physics.Raycast(shootRay, out shootHit, range, shootableMask))
        {
            EnemyHealth1 enemyHealth = shootHit.collider.GetComponent <EnemyHealth1>();
            if (enemyHealth != null)
            {
                enemyHealth.TakeDamage(damagePerHit, shootHit.point);
            }
            BossHealth bossHealth = shootHit.collider.GetComponent <BossHealth>();
            if (bossHealth != null)
            {
                bossHealth.TakeDamage(damagePerHit, shootHit.point);
            }
            gunLine.SetPosition(1, shootHit.point);
        }
        else
        {
            gunLine.SetPosition(1, shootRay.origin + shootRay.direction * range);
        }
    }
コード例 #2
0
    void Start()
    {
        if (!GameMasterObject.isFinalLevel)
        {
            GameMasterObject.targets.Add(myTransform);
            //GameMasterObject.enemyMechs.Add (this.gameObject);
            player       = GameMasterObject.playerUse;
            playerHealth = player.GetComponent <PlayerHealth1> ();
            target       = player.transform;
            dragonIsHere = false;
        }
        else if (GameMasterObject.isFinalLevel)
        {
//			GameMasterObject.targets.Add (myTransform);
            //GameMasterObject.enemyMechs.Add (this.gameObject);

            if (dragon != null)
            {
                timer        = 0;
                target       = dragon.transform;
                targetHealth = dragon.GetComponent <EnemyHealth1> ();
                dragonIsHere = true;
                maxDistance  = Random.Range(150, 250);
            }
//			player = GameMasterObject.playerUse;
//			playerHealth = player.GetComponent<PlayerHealth1> ();
//			target = player.transform;
        }
    }
コード例 #3
0
ファイル: ZombieMovement.cs プロジェクト: Jyngwe/UnityLek
 // Use this for initialization
 void Awake()
 {
     player       = GameObject.FindGameObjectWithTag("Player").transform;
     playerHealth = player.GetComponent <PlayerHealth>();
     enemyHealth  = GetComponent <EnemyHealth1>();
     nav          = GetComponent <NavMeshAgent>();
 }
コード例 #4
0
 void Awake()
 {
     SelectTarget();
     intTimer    = timer; //Store the inital value of timer
     anim        = GetComponent <Animator>();
     enemyHealth = GetComponentInChildren <EnemyHealth1>();
 }
コード例 #5
0
    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);
    }
コード例 #6
0
 void Awake()
 {
     myTransform = transform;
     anim        = GetComponent <Animator>();
     sound       = GetComponent <AudioSource>();
     myHealth    = GetComponent <EnemyHealth1> ();
 }
コード例 #7
0
 // Use this for initialization
 void Awake()
 {
     player       = GameObject.FindGameObjectWithTag("Player");
     playerHealth = player.GetComponent <PlayerHealth>();
     enemyHealth  = GetComponent <EnemyHealth1>();
     anim         = GetComponent <Animator>();
 }
コード例 #8
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);
        }
    }
コード例 #9
0
 void Awake()
 {
     SubEnemy = GameObject.FindGameObjectWithTag("SubEnemy 1");
     if (SubEnemy != null)
     {
         enemyHealth = SubEnemy.GetComponent <EnemyHealth1> ();
     }
 }
コード例 #10
0
 void Awake()
 {
     myTransform = transform;
     anim        = GetComponent <Animator>();
     sound       = GetComponent <AudioSource>();
     range       = GetComponent <SphereCollider>();
     sights      = GetComponent <BoxCollider>();
     myHealth    = GetComponent <EnemyHealth1> ();
 }
コード例 #11
0
    void Attack()
    {
        if (selectTarget != null)
        {
            BlockCharacterLife enemyHealth = selectTarget.GetComponent <BlockCharacterLife>();
            if (enemyHealth != null)
            {
                enemyHealth.shots += blockCharDamage;
            }

            EnemyHealth1 enemyHealth1 = selectTarget.GetComponent <EnemyHealth1> ();
            if (enemyHealth1 != null)
            {
                enemyHealth1.TakeDamage(damage * damage, selectTarget.position + new Vector3(0, 5, 0));
            }
        }
    }
コード例 #12
0
 void Attack()
 {
     timer         = 0f;
     currentPower -= Time.deltaTime * powerDrain;
     if (selectTarget != null)
     {
         BlockCharacterLife enemyHealth = selectTarget.GetComponent <BlockCharacterLife>();
         if (enemyHealth != null)
         {
             enemyHealth.shots += blockCharDamage;
         }
         EnemyHealth1 enemyHealth1 = selectTarget.GetComponent <EnemyHealth1> ();
         if (enemyHealth1 != null)
         {
             enemyHealth1.TakeDamage(damage * damage, selectTarget.position + new Vector3(0, 5, 0));
         }
     }
 }
コード例 #13
0
    void OnTriggerEnter(Collider other)
    {
        //Debug.Log (other.gameObject.tag);
        //Debug.Log (other.gameObject);
        if (other.gameObject.tag == "Weapon" && !seen)
        {
            HUDDeflectionScript.count = 0;

            Destroy(other.gameObject);
        }

        if (other.gameObject.tag == "Player" && !GameMasterObject.isFinalLevel)
        {
            seen         = true;
            timer        = 0;
            target       = other.gameObject.transform;
            player       = other.gameObject;
            playerHealth = player.GetComponent <PlayerHealth1> ();
        }
        if (other.gameObject.tag == "Boss")
        {
            seen         = true;
            timer        = 0;
            target       = other.gameObject.transform;
            targetHealth = other.gameObject.GetComponent <EnemyHealth1> ();
        }
        if (other.gameObject.tag == "Ally" && seen && hasPower)
        {
            MechShoot();
            timer      = 0;
            target     = other.gameObject.transform;
            player     = other.gameObject;
            dannyDecoy = player.GetComponent <DannyDecoyLifeScript> ();
        }

        if (other.gameObject.tag == "Player" && seen && hasPower && !GameMasterObject.isFinalLevel)
        {
            MechShoot();
        }
        if (other.gameObject.tag == "Ally" && seen && hasPower && !GameMasterObject.isFinalLevel)
        {
            MechShoot();
        }
    }
コード例 #14
0
ファイル: PlayerAttack.cs プロジェクト: PatrikRiku/UnityLek
    void Attack()
    {
        timer = 0f;

        spearLight.enabled = true;
        anim.SetTrigger("PlayerAttack");

        attackRay.origin    = transform.position;
        attackRay.direction = transform.forward;

        if (Physics.Raycast(attackRay, out attackHit, range, shootableMask))
        {
            EnemyHealth1 enemyHealth = attackHit.collider.GetComponent <EnemyHealth1>();
            if (enemyHealth != null)
            {
                enemyHealth.TakeDamage(damagePerHit, attackHit.point);
            }
        }
    }
コード例 #15
0
 void Start()
 {
     if (!GameMasterObject.isFinalLevel)
     {
         GameMasterObject.targets.Add(myTransform);
         target       = null;
         dragonIsHere = false;
     }
     else if (GameMasterObject.isFinalLevel)
     {
         if (dragon != null)
         {
             timer        = 0;
             target       = dragon.transform;
             targetHealth = dragon.GetComponent <EnemyHealth1> ();
             dragonIsHere = true;
             maxDistance  = Random.Range(150, 350);
         }
     }
 }
コード例 #16
0
 private void OnTriggerStay(Collider other)
 {
     if (TimetoAtk < 0f)
     {
         TimetoAtk = 0f;
     }
     if (TimetoAtk > 0f)
     {
         TimetoAtk -= Time.deltaTime;
     }
     if (other.gameObject.tag == "enemy" && Input.GetMouseButtonDown(0))
     {
         if (TimetoAtk == 0f)
         {
             EnemyHealth1 Ehealth = other.gameObject.GetComponent <EnemyHealth1>();
             Ehealth.adjustcurrenthealth(attack_Power);
             TimetoAtk = Cooldown;
         }
     }
 }
コード例 #17
0
ファイル: EnemyManager.cs プロジェクト: Jyngwe/UnityLek
    void Spawn()
    {
        if (playerHealth.currentHealth <= 0f)
        {
            return;
        }

        for (int i = 0; i < zombies.Count; i++)
        {
            if (!zombies[i].activeInHierarchy)
            {
                enemyHealth = zombies[i].GetComponent <EnemyHealth1>();
                navZombie   = zombies[i].GetComponent <NavMeshAgent>();
                enemyAttack = zombies[i].GetComponent <EnemyAttack>();

                //Randomize storlek, snabbhet och attackDamage på zombies
                navZombie.transform.localScale = Vector3.one * (Random.Range(3f, 10f));

                navZombie.speed            = 11 - navZombie.transform.localScale.x;
                enemyHealth.startingHealth = navZombie.transform.localScale.x * 20;
                enemyHealth.currentHealth  = enemyHealth.startingHealth;

                enemyAttack.attackDamage = (int)navZombie.transform.localScale.x * 2;

                if (Random.Range(0, 100) < 30)
                {
                    enemyHealth.hasHealthPack = true;
                }

                //Slumpa fram spawnpoint innan aktuell zombie blir aktiv
                int spawnPointIndex = Random.Range(0, spawnPoints.Length);
                zombies[i].transform.position = spawnPoints[spawnPointIndex].position;
                zombies[i].transform.rotation = spawnPoints[spawnPointIndex].rotation;
                zombies[i].SetActive(true);
                navZombie.enabled = true;
                break;
            }
        }
    }
コード例 #18
0
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Head")
     {
         BlockCharacterLife blockCharLife = other.gameObject.GetComponentInParent <BlockCharacterLife> ();
         if (blockCharLife != null)
         {
             blockCharLife.shots += 10000;
         }
         EnemyHealth1 enemyHealth = other.gameObject.GetComponentInParent <EnemyHealth1> ();
         if (enemyHealth != null)
         {
             enemyHealth.TakeDamage(10000, transform.position);
         }
     }
     if (other.gameObject.tag == "TC Spawner")
     {
         Destroy(other.gameObject);
     }
     if (other.gameObject.tag == "Player")
     {
         PlayerHealth1 playerHealth = other.gameObject.GetComponent <PlayerHealth1> ();
         if (playerHealth != null)
         {
             playerHealth.Restore();
         }
     }
     if (other.gameObject.tag == "Ally")
     {
         AllyDroneScript allyScript = other.gameObject.GetComponent <AllyDroneScript> ();
         if (allyScript != null)
         {
             allyScript.currentPower = allyScript.startingPower;
         }
     }
 }
コード例 #19
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);
                    }
                }
            }
        }
    }
コード例 #20
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Body" && ableToEffect)
        {
            BlockCharacterLife blockCharLife = other.transform.GetComponentInParent <BlockCharacterLife>();
            if (blockCharLife != null)
            {
                blockCharLife.shots += 250;
            }
            EnemyHealth1 enemyHealth = other.gameObject.GetComponentInParent <EnemyHealth1> ();
            if (enemyHealth != null)
            {
                enemyHealth.TakeDamage(damage * meleeDamage, other.transform.position);
            }
            gotHit      = true;
            sounds.clip = hits [Random.Range(0, hits.Length - 1)];
            sounds.Play();
            sound2.Play();
        }
        else if (other.transform.tag == "TutorialDoors" && ableToEffect)
        {
            CauseDamageDestroy causeDD = other.transform.GetComponentInParent <CauseDamageDestroy>();
            if (causeDD != null)
            {
                causeDD.shots += 2;
            }
            sounds.clip = hits [Random.Range(0, hits.Length - 1)];
            sounds.Play();
            sound2.Play();
        }
        else if (other.transform.tag == "Tower Turret" && ableToEffect)
        {
            CauseDamageDestroy causeDD = other.transform.GetComponentInParent <CauseDamageDestroy>();
            if (causeDD != null)
            {
                causeDD.shots += 200;
            }
            sounds.clip = hits [Random.Range(0, hits.Length - 1)];
            sounds.Play();
            sound2.Play();
        }

        if (other.gameObject.tag == "Head" && ableToEffect)
        {
            BlockCharacterLife blockCharLife = other.transform.GetComponentInParent <BlockCharacterLife>();
            if (blockCharLife != null)
            {
                blockCharLife.shots += 250;
            }
            EnemyHealth1 enemyHealth = other.gameObject.GetComponentInParent <EnemyHealth1> ();
            if (enemyHealth != null)
            {
                enemyHealth.TakeDamage(damage * meleeDamage, other.transform.position);
            }
            gotHit      = true;
            sounds.clip = hits [Random.Range(0, hits.Length - 1)];
            sounds.Play();
            sound2.Play();
        }

        if (other.gameObject.tag == "Enemy" && ableToEffect)
        {
            BlockCharacterLife blockCharLife = other.transform.GetComponentInParent <BlockCharacterLife>();
            if (blockCharLife != null)
            {
                blockCharLife.shots += 50;
            }
            EnemyHealth1 enemyHealth = other.gameObject.GetComponentInParent <EnemyHealth1> ();
            if (enemyHealth != null)
            {
                enemyHealth.TakeDamage(damage * meleeDamage, other.transform.position);
            }
            gotHit      = true;
            sounds.clip = hits [Random.Range(0, hits.Length - 1)];
            sounds.Play();
            sound2.Play();
        }

        if (other.gameObject.tag == "Arms" && ableToEffect)
        {
            BlockCharacterLife blockCharLife = other.transform.GetComponentInParent <BlockCharacterLife>();
            if (blockCharLife != null)
            {
                blockCharLife.shots += 250;
            }
            EnemyHealth1 enemyHealth = other.gameObject.GetComponentInParent <EnemyHealth1> ();
            if (enemyHealth != null)
            {
                enemyHealth.TakeDamage(damage * meleeDamage, other.transform.position);
            }
            gotHit      = true;
            sounds.clip = hits [Random.Range(0, hits.Length - 1)];
            sounds.Play();
            sound2.Play();
        }

        if (other.gameObject.tag == "Legs" && ableToEffect)
        {
            BlockCharacterLife blockCharLife = other.transform.GetComponentInParent <BlockCharacterLife>();
            if (blockCharLife != null)
            {
                blockCharLife.shots += 250;
            }
            EnemyHealth1 enemyHealth = other.gameObject.GetComponentInParent <EnemyHealth1> ();
            if (enemyHealth != null)
            {
                enemyHealth.TakeDamage(damage * meleeDamage, other.transform.position);
            }
            gotHit      = true;
            sounds.clip = hits [Random.Range(0, hits.Length - 1)];
            sounds.Play();
            sound2.Play();
        }
    }
コード例 #21
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;
				}*/				
				}
			}
	}
コード例 #22
0
    void OnCollisionEnter(Collision other)
    {
        //set to only effect gameobjects with tag Enemy
        if (other.gameObject.tag == "Enemy")
        {
            EnemyHealth1 enemyHealth = other.gameObject.GetComponent <EnemyHealth1>();
            if (enemyHealth != null)
            {
                enemyHealth.TakeDamage(playerAttackDamage * attackBoost, other.transform.position);
                //other.rigidbody.AddForceAtPosition(Vector3.forward * 10, other.transform.position);
            }
        }

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

        if (other.collider.tag == "Head")
        {
            EnemyHealth1 enemyHealth = other.gameObject.GetComponentInParent <EnemyHealth1>();
            if (enemyHealth != null)
            {
                enemyHealth.TakeDamage(headDamage * attackBoost, other.transform.position);
                //other.rigidbody.AddForceAtPosition(Vector3.forward * 10, other.transform.position);
            }
        }

        if (other.collider.tag == "Arms")
        {
            EnemyHealth1 enemyHealth = other.gameObject.GetComponentInParent <EnemyHealth1>();
            if (enemyHealth != null)
            {
                enemyHealth.TakeDamage(armDamage * attackBoost, other.transform.position);
                //other.rigidbody.AddForceAtPosition(Vector3.forward * 10, other.transform.position);
            }
        }

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

        //set to only effect gameobjects with tag Cover
        else if (other.gameObject.tag == "Cover")
        {
            Destroy(this.gameObject);
        }

        else
        {
            Destroy(this.gameObject);
        }

        Destroy(this.gameObject);
    }
コード例 #23
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);
        }
    }
コード例 #24
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);
    }
コード例 #25
0
 private void Awake()
 {
     enemyParent = GetComponentInParent <Enemy_behaviour_1>();
     enemyHealth = GameObject.Find("BigFSkeleton/skeleton1_collider").GetComponent <EnemyHealth1>();
     anim        = GetComponentInParent <Animator>();
 }
コード例 #26
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Enemy")
        {
            BlockCharacterLife causeD = other.gameObject.GetComponentInParent <BlockCharacterLife>();
            if (causeD != null)
            {
                Debug.Log("hereenemy");
                causeD.shots += 1;
            }

            EnemyHealth1 causeDD = other.gameObject.GetComponentInParent <EnemyHealth1>();
            if (causeDD != null)
            {
                causeDD.TakeDamage(damage * damageMultiplier, transform.position);
            }
        }
        else if (other.gameObject.tag == "Head")
        {
            BlockCharacterLife causeD = other.gameObject.GetComponentInParent <BlockCharacterLife>();
            if (causeD != null)
            {
                Debug.Log("herehead");
                causeD.shots += 1;
            }

            EnemyHealth1 causeDD = other.gameObject.GetComponentInParent <EnemyHealth1>();
            if (causeDD != null)
            {
                causeDD.TakeDamage(damage * damageMultiplier, transform.position);
            }
        }
        else if (other.gameObject.tag == "Body")
        {
            BlockCharacterLife causeD = other.gameObject.GetComponentInParent <BlockCharacterLife>();
            if (causeD != null)
            {
                Debug.Log("herebody");
                causeD.shots += 1;
            }

            EnemyHealth1 causeDD = other.gameObject.GetComponentInParent <EnemyHealth1>();
            if (causeDD != null)
            {
                causeDD.TakeDamage(damage * damageMultiplier, transform.position);
            }
        }
        else if (other.gameObject.tag == "Legs")
        {
            BlockCharacterLife causeD = other.gameObject.GetComponentInParent <BlockCharacterLife>();
            if (causeD != null)
            {
                Debug.Log("herelegs");
                causeD.shots += 1;
            }

            EnemyHealth1 causeDD = other.gameObject.GetComponentInParent <EnemyHealth1>();
            if (causeDD != null)
            {
                causeDD.TakeDamage(damage * damageMultiplier, transform.position);
            }
        }
        else if (other.gameObject.tag == "Arms")
        {
            BlockCharacterLife causeD = other.gameObject.GetComponentInParent <BlockCharacterLife>();
            if (causeD != null)
            {
                Debug.Log("herearms");
                causeD.shots += 1;
            }

            EnemyHealth1 causeDD = other.gameObject.GetComponentInParent <EnemyHealth1>();
            if (causeDD != null)
            {
                causeDD.TakeDamage(damage * damageMultiplier, transform.position);
            }
        }
    }
コード例 #27
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);
                    }
                }
            }
        }
    }
コード例 #28
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);
                    }
                }
            }
        }
    }
コード例 #29
0
ファイル: RockNetwork.cs プロジェクト: jdelaay025/Joyful-Game
    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);
    }