//public GameObject assualtRifle; void Awake() { sound = GetComponent <AudioSource>(); playerHealth = GetComponent <PlayerHealth1>(); //ar = assualtRifle.GetComponent<CamShootAR>(); }
void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Weapon") { HUDDeflectionScript.count = 0; Destroy(other.gameObject); } if (other.gameObject.tag == "Player") { timer = 0; target = other.gameObject.transform; player = other.gameObject; playerHealth = player.GetComponent <PlayerHealth1> (); } if (other.gameObject.tag == "Ally" && hasPower) { MechShoot(); timer = 0; target = other.gameObject.transform; player = other.gameObject; dannyDecoy = player.GetComponent <DannyDecoyLifeScript> (); } if (other.gameObject.tag == "Player" && hasPower) { MechShoot(); } if (other.gameObject.tag == "Ally" && hasPower) { MechShoot(); } }
void Awake() { player = GameObject.FindGameObjectWithTag("Player"); playerHealth = player.GetComponent <PlayerHealth1> (); enemyHealth = GetComponent <EnemyHealth1>(); anim = GetComponent <Animator>(); }
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; } }
void Start() { player = gmObj.player; playerHealth = player.GetComponent <PlayerHealth1> (); //FindAllies (); InvokeRepeating("Spawn", 33, spawnTime); // waveCon.nextWaveTimer = 30; }
void Start() { GameMasterObject.targets.Add(myTransform); //GameMasterObject.enemyMechs.Add (this.gameObject); player = GameMasterObject.playerUse; playerHealth = player.GetComponent <PlayerHealth1> (); target = player.transform; }
//CamShootRL rl; void Awake() { dannyMovement = player.GetComponent <DannyMovement>(); // movespeedmultiplier is a float playerHealth = player.GetComponent <PlayerHealth1>(); // ar = assualtRifle.GetComponent <AssualtRifleRaycast>(); // hg = handGun.GetComponent <HandGunRaycast>(); // sg = shotGun.GetComponent <ShotGunRacast>(); // //rl = rocketLauncher.GetComponent<CamShootRL>(); // }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { PlayerHealth1 PHealth = GameObject.Find("player").GetComponent <PlayerHealth1>(); PHealth.adjustcurrenthealth(20f); Destroy(body); } }
void Awake() { sound = GetComponent <AudioSource>(); playerHealth = GetComponent <PlayerHealth1>(); arRC = assualtRifle.GetComponent <AssualtRifleRaycast>(); hgRC = handGun.GetComponent <HandGunRaycast>(); sgRC = shotGun.GetComponent <ShotGunRacast>(); }
void OnTriggerStay(Collider other) { if (other.gameObject.tag == "Player" && seen && hasPower) { MechShoot(); timer = 0; target = other.gameObject.transform; player = other.gameObject; playerHealth = player.GetComponent <PlayerHealth1> (); } }
private void OnTriggerEnter(Collider other) { wink = GameObject.Find("WINK").GetComponent <AudioSource>(); if (other.gameObject.tag == "Player") { PlayerHealth1 PHealth = GameObject.Find("player").GetComponent <PlayerHealth1>(); wink.Play(); PHealth.adjustcurrenthealth(100f); Destroy(body); GemCanvas.SetActive(true); } }
void OnCollisionEnter(Collision other) { if (other.gameObject.tag == "Player") { PlayerHealth1 playerHealth = other.gameObject.GetComponent <PlayerHealth1> (); if (playerHealth != null) { HUDHealthScript.timer = 0; if (playerHealth.currentHealth > 0 && playerHealth.currentHealth <= playerHealth.startingHealth) { playerHealth.TakeDamage(attackDamage * enemyAttackBoost, 100f); if (GameMasterObject.dannyActive) { DannyCameraShake.InstanceD1.ShakeD1(amplitude, duration); } else if (GameMasterObject.strongmanActive) { CameraShake.InstanceSM1.ShakeSM1(amplitude, duration); } } else if (playerHealth.currentHealth > 0 && playerHealth.currentHealth >= playerHealth.startingHealth + 1) { playerHealth.TakeArmorDamage(attackDamage * enemyAttackBoost, 100f); if (GameMasterObject.dannyActive) { DannyCameraShake.InstanceD1.ShakeD1(amplitude, duration); } else if (GameMasterObject.strongmanActive) { CameraShake.InstanceSM1.ShakeSM1(amplitude, duration); } } } } if (other.gameObject.tag == "Ally") { DannyDecoyLifeScript decoyLife = other.gameObject.GetComponent <DannyDecoyLifeScript> (); if (decoyLife != null) { decoyLife.shots++; } } if (other.gameObject.tag == "Cover") { Destroy(this.gameObject); } else { Destroy(this.gameObject); } Destroy(this.gameObject); }
void Start() { GameObject player1Object = GameObject.FindWithTag("Player1"); if (player1Object != null) { player1 = player1Object.GetComponent <PlayerHealth1>(); } if (player1 == null) { Debug.Log("Cannot find 'PlayerHealth1' script"); } }
void Awake() { currentTime = Time.time; anim = GetComponent <Animator> (); anim.SetFloat("shrink", 0); TopLeft.SetActive(false); BotRight.SetActive(false); check = false; fallingP1 = false; fallingP2 = false; player1Movementscript = Player1.GetComponent <PlayerMovement> (); player2Movementscript = Player2.GetComponent <PlayerMovement> (); player1Healthscript = Player1.GetComponent <PlayerHealth1> (); player2Healthscript = Player2.GetComponent <PlayerHealth2> (); }
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(); } }
void Start() { if (Camera.main != null) { cam = Camera.main.transform; } if (GameMasterObject.isMultiplayer) { GameMasterObject.strongmanNetwork = this.gameObject; GameMasterObject.dannyActive = false; GameMasterObject.strongmanActive = true; GameMasterObject.getStrongmanInfo = true; } rigidBody = GetComponent <Rigidbody> (); playerHealth = GetComponent <PlayerHealth1> (); charMove = GetComponent <StrongManMovement> (); anim = GetComponent <Animator>(); freeCamLook = cameraGO.GetComponent <FreeCameraLook>(); // sound = GetComponent<AudioSource> (); jumpRC = GetComponent <StrongManJumpingRaycast>(); shootCounter = 10; wZC = cameraGO.GetComponentInChildren <StrongManWeaponCameraZoom>(); turnSensitivity = GameMasterObject.turnSpeedNumber; fsScript = finalStrike.GetComponent <FinalStrikeForce> (); if (GameMasterObject.isMultiplayer) { rockThrowPic = EquipRock.rockPic; platformPic = EquipPlat.platPic; ragePic = EquipRage.ragePic; nothingUsing = EquipCant1.cantImage; } rockThrowPic.color = notEquipedColor; platformPic.color = goColor; ragePic.color = notEquipedColor; nothingUsing.color = notEquipedColor; targetingSpawnPoint = BulletSpawnSpot.myTransform; }
void OnTriggerStay(Collider other) { if (other.gameObject.tag == "Player" && seen && hasPower && !GameMasterObject.isFinalLevel) { MechShoot(); timer = 0; target = other.gameObject.transform; player = other.gameObject; playerHealth = player.GetComponent <PlayerHealth1> (); } if (other.gameObject.tag == "Ally" && seen && hasPower && !GameMasterObject.isFinalLevel) { MechShoot(); timer = 0; target = other.gameObject.transform; player = other.gameObject; dannyDecoy = player.GetComponent <DannyDecoyLifeScript> (); } }
void Start() { if (Camera.main != null) { cam = Camera.main.transform; } if (GameMasterObject.isMultiplayer) { GameMasterObject.dannyNetwork = this.gameObject; GameMasterObject.getDannyInfo = true; PauseManager.getDannyInfo = true; GameMasterObject.dannyActive = true; GameMasterObject.strongmanActive = false; } spawnAllyBlock = cam.GetComponent <BlockAllySpawn> (); playerHealth = GetComponent <PlayerHealth1> (); charMove = GetComponent <DannyMovement> (); anim = GetComponent <Animator>(); freeCamLook = cameraGO.GetComponent <FreeCameraLook>(); // dannyWeapon = GetComponent<DannyWeaponScript>(); jumpRC = GetComponent <JumpingRaycastDown>(); shootCounter = 10; // if(lift != null) // { // anim2 = lift.GetComponent<Animator>(); // liftScript = lift.GetComponent<LiftScript> (); // } wZC = cameraGO.GetComponentInChildren <WeaponCameraZoom>(); turnSensitivity = GameMasterObject.turnSpeedNumber; if (bowStaffObject != null) { bowAttack = bowStaffObject.GetComponent <PlayerBowStaff>(); } if (blazeSwordObject != null) { blazeAttack = blazeSwordObject.GetComponent <PlayerBowStaff>(); } }
//GameObject enemy; //GameObject enemyZombie; void Awake() { mechShoot = GetComponent <TurnAndShoot>(); player = GameObject.FindGameObjectWithTag("Player"); playerHealth = player.GetComponent <PlayerHealth1> (); enemyLayer = LayerMask.GetMask("Enemy"); //enemy = GameObject.FindGameObjectWithTag (""); //enemyHealth = enemy.GetComponent<EnemyHealth1>(); //enemyZombie = GetComponent<EnemyHealthZombie>(); //speed = 150; attackDamage = Random.Range(10, 20); bodyDamage = Random.Range(10, 20); headDamage = Random.Range(40, 100); armDamage = Random.Range(3, 4); legDamage = Random.Range(5, 7); playerAttackDamage = Random.Range(10, 20); myTransform = transform.position; }
void OnTriggerStay(Collider other) { if (other.gameObject.tag == "Player") { anim.SetTrigger("IsAttack"); if (TimetoAtk < 0f) { TimetoAtk = 0f; } if (TimetoAtk == 0f) { PlayerHealth1 Phealth = GameObject.Find("player").GetComponent <PlayerHealth1>(); Phealth.adjustcurrenthealth(damage); hit.volume = 0.1f; hit.Play(); TimetoAtk = Cooldown; } if (TimetoAtk > 0f) { TimetoAtk -= Time.deltaTime; } } }
void Update() { RaycastHit hit; if (timer > 0) { timer -= Time.deltaTime; Collider[] cols = Physics.OverlapSphere(transform.position, 15f, myMask); for (int i = 0; i < cols.Length; i++) { Rigidbody targetRigidBody = cols [i].GetComponent <Rigidbody> (); if (!targetRigidBody) { AllyDroneScript allyDrone = cols[i].GetComponentInParent <AllyDroneScript>(); if (allyDrone != null) { allyDrone.currentPower -= damage; } continue; } targetRigidBody.AddExplosionForce(m_ExplosionForce, transform.position, m_ExplosionRadius, 3f, ForceMode.Impulse); if (targetRigidBody != null) { PlayerHealth1 playerHealth = targetRigidBody.GetComponent <PlayerHealth1> (); if (playerHealth != null) { // Debug.Log ("Reached It"); playerHealth.TakeDamage(damage); playerHealth = null; return; } } } } }
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; } } }
void Start() { player = GameMasterObject.playerUse; playerHealth = player.GetComponent <PlayerHealth1> (); target = player.transform; }
void Start() { // Debug.Log (spawnTravelers); GetWaveLevels(); #if UNITY_EDITOR if (GameMasterObject.hasPersist) { spawnTravelers = PersistThroughScenes.saveTravelers; } else { spawnTravelers = true; } #else if (GameMasterObject.hasPersist) { spawnTravelers = PersistThroughScenes.saveTravelers; } else { spawnTravelers = false; } #endif if (waveNumber != "End Boss") { player = GameMasterObject.playerUse; playerHealth = player.GetComponent <PlayerHealth1> (); if (spawnTravelers) { lv1num = 2000; lv1numTC = 4; currentWave = lv1num; currentTCs = lv1numTC; lv2num = 2000; lv3num = 2000; lv4num = 2000; lv5num = 2000; lv6num = 2000; lv7num = 2000; lv8num = 2000; lv9num = 2000; lv10num = 2000; InvokeRepeating("TimerCheckSpawn", 25, 7); } else { lv1num = 50; lv1numTC = 4; currentWave = lv1num; currentTCs = lv1numTC; lv2num = 400; lv3num = 500; lv4num = 600; lv5num = 700; lv6num = 800; lv7num = 900; lv8num = 1000; lv9num = 1500; lv10num = 2000; } InvokeRepeating("Spawn", 33, spawnTime); InvokeRepeating("SpawnGunner", 33, 30); nextWaveTimer = 30; timerCheckIcon.SetActive(true); } else { player = GameMasterObject.playerUse; playerHealth = player.GetComponent <PlayerHealth1> (); Invoke("ActivateMidBoss1", 10); Invoke("ActivateMidBosses2", 10); Invoke("ActivateMidBosses3", 10); Invoke("ActivateMidBosses4", 10); Invoke("ActivateMidBosses5", 10); waves [10] = true; startSpawn = true; } // lv2num = 20; // lv3num = 25; // lv4num = 75; // lv5num = 85; // lv6num = 100; // lv7num = 135; // lv8num = 140; // lv9num = 200; // lv10num = 300; lv2numTC = 5; lv3numTC = 5; lv4numTC = 11; lv5numTC = 11; lv6numTC = 11; lv7numTC = 11; lv8numTC = 11; lv9numTC = 17; lv10numTC = 23; // lv2num = 2000; // lv3num = 2000; // lv4num = 2000; // lv5num = 2000; // lv6num = 2000; // lv7num = 2000; // lv8num = 2000; // lv9num = 2000; // lv10num = 2000; }
void Update() { playerReflection = player; // Debug.Log (player); targets = GameMasterObject.timerChecks; if (timer < timeBetweenAttacks) { timer += Time.deltaTime; } if (attentionMeter <= possibleAttentiveTime) { attentionMeter += Time.deltaTime; } if (timer >= timeBetweenAttacks && playerInRange /* && !blockHealthScript.dead*/) { anim.SetTrigger("Attack"); Attack(); timer = 0; } if (distFromPlayer > 30f) { playerHealth = null; } if (distFromPlayer <= 75f && initiallyInterested && !lookingAtPlayer) { targetToUse = player.transform; attentionMeter = 0; lookingAtPlayer = true; } else if (initiallyInterested && lookingAtPlayer) { targetToUse = player.transform; if (attentionMeter >= possibleAttentiveTime) { initiallyInterested = false; } } else if (selectTarget == null && distFromPlayer >= dist) { if (targets.Count > 0) { TargetEnemy(); } else { targetToUse = player.transform; } } else if (distFromPlayer <= 75f /* && blockHealthScript.shots <= blockHealthScript.shots / 2*/) { targetToUse = player.transform; } else if (distFromPlayer <= 75f && !initiallyInterested && lookingAtPlayer && attentionMeter >= possibleAttentiveTime) { targetToUse = selectTarget; } else if (!initiallyInterested && lookingAtPlayer && attentionMeter >= possibleAttentiveTime) { targetToUse = selectTarget; } else { targetToUse = selectTarget; } if (targetToUse != null) { rotPoint = Quaternion.LookRotation((targetToUse.position + new Vector3(0f, 7f, 0f)) - myTransform.position); lookingAt = Quaternion.Slerp(myTransform.rotation, rotPoint, turnSpeed * turnSpeedManipulator * Time.deltaTime); dist = Vector3.Distance(myTransform.position, targetToUse.position); distFromPlayer = Vector3.Distance(myTransform.position, player.transform.position); } if (dist <= closeEnough /* && !blockHealthScript.dead*/) { myTransform.rotation = lookingAt; if (chase) { anim.SetFloat("vSpeed", 1); chase = false; } if (dist > maxDistance) { //Move Towards target. anim.SetBool("Awake", true); myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime; chase = true; } else if (dist <= maxDistance) { anim.SetFloat("vSpeed", 0); } } else if (dist > closeEnough) { chase = false; DeselectTarget(); anim.SetFloat("vSpeed", 0); } if (switchPlayer) { if (switchPlayerTimer > 0) { switchPlayerTimer -= Time.deltaTime; } else { switchPlayer = false; } } if (targetToUse != null && targets.Count <= 0 && !switchPlayer || targetToUse != null && targets.Count > 0 && !switchPlayer) { // Debug.Log ("Return"); return; } else if (targetToUse != null && targets.Count > 0 && switchPlayer) { TargetEnemy(); } else if (targetToUse != null && targets.Count <= 0 && switchPlayer) { //Debug.Log ("Return"); targetToUse = GameMasterObject.playerUse.transform; selectTarget = GameMasterObject.playerUse.transform; } else if (selectTarget == null && targets.Count > 0 && !switchPlayer) { playerInRange = false; TargetEnemy(); } else if (targetToUse == null && targets.Count <= 0 && !switchPlayer) { targetToUse = GameMasterObject.playerUse.transform; selectTarget = GameMasterObject.playerUse.transform; } }
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); }