// Update is called once per frame void Update() { if (BGScript.getIsFalling() || BGScript.getisAlive() == false) { // col.enabled = false; col.isTrigger = true; } else { //col.enabled = true; col.isTrigger = false; } if (BGScript.getisAlive() == false) { GameObject[] enemies = GameObject.FindGameObjectsWithTag("BreakableGravity"); foreach (GameObject en in enemies) { if (en.GetComponent <CharacterController> () != gameObject.transform.parent.gameObject.GetComponent <CharacterController> ()) { Physics.IgnoreCollision(gameObject.transform.parent.gameObject.GetComponent <CharacterController> (), en.GetComponent <CharacterController> ()); } } } else { /* * GameObject[] enemies = GameObject.FindGameObjectsWithTag ("BreakableGravity"); * * foreach (GameObject en in enemies) { * if (en.GetComponent<CharacterController> () != gameObject.transform.parent.gameObject.GetComponent<CharacterController> ()) { * Physics.IgnoreCollision (gameObject.transform.parent.gameObject.GetComponent<CharacterController> (), en.GetComponent<CharacterController> (), false); * } * } */ } /* * if (BGScript.getisAlive() == false){ * col.enabled = false; * } */ // Debug.Log (BGScript.getisAlive ()); }
// Update is called once per frame void Update() { if (BGScript.getIsFalling()) { col.enabled = true; } else { col.enabled = false; } if (BGScript.getisAlive() == false) { col.enabled = false; } }
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(); } } } } }