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 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 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 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> (); } }