void OnTriggerEnter(Collider other) { if (characterBehavior == null) { return; } if ( characterBehavior.state == CharacterBehavior.states.DEAD || characterBehavior.state == CharacterBehavior.states.CRASH || characterBehavior.state == CharacterBehavior.states.FALL ) { return; } if (other.tag == "wall" || other.tag == "firewall") { if (characterBehavior.state == CharacterBehavior.states.SHOOT) { return; } if (player.fxState == Player.fxStates.NORMAL) { characterBehavior.data.events.AddExplotion(transform.position, Color.red); characterBehavior.Hit(); } // else // other.GetComponent<WeakPlatform>().breakOut(transform.position); } if (other.tag == "destroyable") { if (characterBehavior.state == CharacterBehavior.states.SHOOT) { return; } if (player.fxState == Player.fxStates.NORMAL) { Breakable breakable = other.GetComponent <Breakable> (); if (breakable != null) { if (breakable.ifJumpingDontKill && characterBehavior.IsJumping() && breakable.transform.position.y < transform.position.y) { characterBehavior.SuperJumpByHittingSomething(); } else if (!breakable.dontKillPlayers) { characterBehavior.HitWithObject(other.transform.position); } } } } else if (other.tag == "floor") { CharacterAnimationForcer chanimF = other.GetComponent <CharacterAnimationForcer> (); if (chanimF != null) { switch (chanimF.characterAnimation) { case CharacterAnimationForcer.animate.SLIDE: characterBehavior.Slide(); break; } } float difY = transform.position.y - other.transform.position.y; if (other.transform.eulerAngles.x == 0 && difY < 1.6f) { //si es una plataforma rotada se va: SceneObject so = other.transform.GetComponentInParent <SceneObject>(); if (so != null && so.transform.localEulerAngles != Vector3.zero) { return; } Vector3 pos = characterBehavior.transform.position; if (difY < -0.5f) { characterBehavior.Hit(); return; } else if (difY < 0.15f) { characterBehavior.SuperJumpByBumped(2600, 0.5f, false); } else if (difY < 0.5f) { characterBehavior.SuperJumpByBumped(2000, 0.5f, false); } else { characterBehavior.SuperJumpByBumped(1200, 0.5f, false); } pos.y += difY; characterBehavior.transform.position = pos; } } else if (other.tag == "enemy") { print("______________" + characterBehavior.state + characterBehavior.IsJumping()); if (characterBehavior.IsJumping()) { MmoCharacter mmoCharacter = other.GetComponent <MmoCharacter> (); if (mmoCharacter != null) { other.GetComponent <MmoCharacter> ().Die(); } characterBehavior.SuperJumpByBumped(920, 0.5f, false); return; } if (player.fxState == Player.fxStates.NORMAL) { characterBehavior.Hit(); } } else if ( other.tag == "fallingObject" && characterBehavior.state != CharacterBehavior.states.FALL ) { if (player.fxState == Player.fxStates.NORMAL) { characterBehavior.Hit(); } } }
void OnTriggerEnter(Collider other) { if (characterBehavior == null) { return; } if (state == states.ON_START_JUMPING) { return; } if (characterBehavior.state == CharacterBehavior.states.DEAD || characterBehavior.state == CharacterBehavior.states.CRASH || characterBehavior.state == CharacterBehavior.states.FALL) { return; } if (state == states.ON_FLY) { return; } if (other.tag == "destroyable") { if (other.GetComponent <CharacterAnimationForcer>()) { switch (other.GetComponent <CharacterAnimationForcer>().characterAnimation) { case CharacterAnimationForcer.animate.SLIDE: characterBehavior.Slide(); break; } } } if (other.tag == "floor" && state != states.ON_FLOOR) { state = states.ON_FLOOR; characterBehavior.OnFloor(); } else if (other.tag == "floor" && !other.GetComponent <SliderFloor>()) { if (transform.parent.gameObject.GetComponent <SliderEffect>()) { transform.parent.gameObject.GetComponent <SliderEffect>().speed = 0; } } else { if (other.tag == "enemy") { if (characterBehavior.state == CharacterBehavior.states.JUMP || characterBehavior.state == CharacterBehavior.states.DOUBLEJUMP || characterBehavior.state == CharacterBehavior.states.SHOOT) { MmoCharacter mmoCharacter = other.GetComponent <MmoCharacter> (); if (mmoCharacter != null) { other.GetComponent <MmoCharacter>().Die(); } else { other.gameObject.SendMessage("breakOut", other.gameObject.transform.position, SendMessageOptions.DontRequireReceiver); } characterBehavior.SuperJumpByBumped(1200, 0.5f, false); } } } }
void OnTriggerEnter(Collider other) { if (characterBehavior == null) { return; } if ( characterBehavior.state == CharacterBehavior.states.DEAD || characterBehavior.state == CharacterBehavior.states.CRASH || characterBehavior.state == CharacterBehavior.states.FALL ) { return; } if (other.tag == "wall" || other.tag == "firewall") { if (characterBehavior.state == CharacterBehavior.states.SHOOT) { return; } if (player.fxState == Player.fxStates.NORMAL) { Data.Instance.events.AddExplotion(transform.position, Color.red); characterBehavior.Hit(); } } if (other.tag == "destroyable") { if (characterBehavior.state == CharacterBehavior.states.SHOOT) { return; } if (player.fxState == Player.fxStates.NORMAL) { Breakable breakable = other.GetComponent <Breakable> (); if (breakable != null) { if (breakable.ifJumpingDontKill && characterBehavior.IsJumping() && breakable.transform.position.y < transform.position.y) { characterBehavior.SuperJumpByHittingSomething(); } else if (!breakable.dontKillPlayers) { characterBehavior.HitWithObject(other.transform.position, false);//breakable.killAtHit); } } } } else if (other.tag == "floor") { CharacterAnimationForcer chanimF = other.GetComponent <CharacterAnimationForcer> (); if (chanimF != null) { switch (chanimF.characterAnimation) { case CharacterAnimationForcer.animate.SLIDE: characterBehavior.Slide(); break; } } float difY = transform.position.y - other.transform.position.y; if (other.transform.localEulerAngles.z > -0.9f && other.transform.localEulerAngles.z < 0.9f) { if (other.transform.eulerAngles.x == 0 && difY < 0.8f) { Vector3 pos = characterBehavior.transform.position; if (difY < -1.55f) { characterBehavior.Hit(); return; } else if (difY < -0.5f) { characterBehavior.SuperJumpByBumped(2400, 0.5f, false); } else if (difY < 0) { characterBehavior.SuperJumpByBumped(2000, 0.5f, false); } else { characterBehavior.SuperJumpByBumped(1200, 0.5f, false); } pos.y += difY; characterBehavior.transform.position = pos; } } } else if (other.tag == "enemy") { MmoCharacter mmoCharacter = other.GetComponent <MmoCharacter> (); if (mmoCharacter != null) { other.GetComponent <MmoCharacter> ().Die(); } if (characterBehavior.IsJumping()) { characterBehavior.SuperJumpByBumped(920, 0.5f, false); return; } else if (player.fxState == Player.fxStates.NORMAL) { characterBehavior.HitWithObject(other.transform.position, false); } } else if ( other.tag == "fallingObject" && characterBehavior.state != CharacterBehavior.states.FALL ) { if (player.fxState == Player.fxStates.NORMAL) { characterBehavior.HitWithObject(other.transform.position, false); } } }