void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Enemy")) { EnemyHealthBase enemyHealth = other.GetComponent <EnemyHealthBase> (); if (enemyHealth != null) { enemyHealth.Damage(damagePerShot); } explosionEffect.Play(); Destroy(gameObject, 0.1f); } else if (other.CompareTag("LowerCollider")) { bossHealth = GameObject.FindGameObjectWithTag("Boss").GetComponent <WhipMasterHealth> (); bossHealth.Damage(damagePerShot); explosionEffect.Play(); Destroy(gameObject, 0.1f); } else if (other.CompareTag("UpperCollider")) { explosionEffect.Play(); Destroy(gameObject, 0.1f); } else if (other.CompareTag("BoxTwo")) { boxHealth = GameObject.FindGameObjectWithTag("BoxTwo").GetComponent <BoxHealth> (); boxHealth.Damage(damagePerShot); explosionEffect.Play(); Destroy(gameObject, 0.1f); } }
void Awake() { fader = GameObject.Find("Fader").GetComponent <ScreenFader> (); temp = GameObject.Find("Player"); bossHealth = GameObject.FindGameObjectWithTag("Boss").GetComponent <WhipMasterHealth> (); textManager = GameObject.Find("TextCanvas").GetComponent <TextManager> (); textManager.RoundStarting(); fader.gameStarting = true; }
void Awake() { spriteRender = GetComponent <SpriteRenderer> (); rdb2 = GetComponent <Rigidbody2D> (); anim = GetComponent <Animator> (); health = GetComponent <WhipMasterHealth> (); bossTransform = GetComponent <Transform> (); playerHealth = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerHealth> (); boxHealth = GameObject.FindGameObjectWithTag("BoxTwo").GetComponent <BoxHealth> (); playerTransform = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform> (); waypoints = GameObject.Find("TeleportPoints").GetComponentsInChildren <Transform> (); seek = ScriptableObject.CreateInstance("SteeringBehaviour") as SteeringBehaviour; seek.tweaker = tweaker; seek.deceleration = deceleration; seek.maxSpeed = maxSpeed; seek.rdb = rdb2; fader.color = Color.clear; targetRotation = Quaternion.Euler(0f, 0f, 0f); bossLocation(); }
void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Enemy")) { EnemyHealthBase enemyHealth = other.GetComponent <EnemyHealthBase> (); if (enemyHealth != null) { enemyHealth.Damage(damage); } playerScore.IncreaseScore(250); } else if (other.CompareTag("LowerCollider") || other.CompareTag("UpperCollider")) { bossHealth = GameObject.FindGameObjectWithTag("Boss").GetComponent <WhipMasterHealth> (); bossHealth.Damage(damage); playerScore.IncreaseScore(550); } else if (other.CompareTag("BoxTwo")) { boxHealth = GameObject.FindGameObjectWithTag("BoxTwo").GetComponent <BoxHealth> (); boxHealth.Damage(damage); playerScore.IncreaseScore(50); } //if-else } //OnTriggerEnter2D