void OnTriggerEnter(Collider other) { if (ControllerScript.getTimeControl() == false) { if (other.tag == "enemybody") { GameObject Root; if (other.gameObject.GetComponent <shooter>() == null) { Root = other.gameObject.transform.parent.gameObject.transform.parent.gameObject; } else { Root = other.gameObject; } if (Root.GetComponent <enemyHealth>().getBlinking() == false && Root.GetComponent <enemyHealth>().getDead() == false) { if (PlayerAnimator.isAttack1ing == true) { Damage = 3; } else if (PlayerAnimator.isAttack2ing == true) { Damage = 1; PlayerController Script = transform.root.GetComponent <PlayerController>(); if (PlayerAnimator.Attack2JumpCount < 3 && ControllerScript.getAttack2Bounce() == false) { Script.Jump(); PlayerAnimator.Attack2JumpCount++; } } //Sends the damage Root.SendMessage("takeDamage", Damage, SendMessageOptions.DontRequireReceiver); } } if (other.tag == "Devilchu") { GameManager.Scene = "Field Extra 2"; GameManager.EventNumber = 0; BBoxScript.Slide("OWWW!! HEY! That actually really hurt!!!"); BBoxScript.setLeftPictureName("Devilchu"); BBoxScript.ActivateEmoticon("Devilchu", "Angry", false); } if (other.tag == "Breakable") { if (other.GetComponent <BreakableGround>() != null) { BreakableGround BGroundScript = other.GetComponent <BreakableGround>(); if (BGroundScript.getisAlive() == true) { BGroundScript.Explode(); } } else if (other.GetComponent <BlockCollider2>() != null) { BreakableGroundGravity BGroundScript = other.transform.parent.gameObject.GetComponent <BreakableGroundGravity>(); if (BGroundScript.getisAlive() == true) { BGroundScript.TakeDamage(); } } } } }
// Use this for initialization void Start() { BGScript = gameObject.transform.parent.gameObject.GetComponent <BreakableGroundGravity> (); col = GetComponent <BoxCollider> (); }