public void boom() { if (boomed) { return; } boomed = true; switch (eType) { case BombType.BTBomb: { GameObject particles = (GameObject)Instantiate(explosion); particles.transform.position = this.transform.position; // particles.transform.localScale = new Vector3(5000,5000,5000); Destroy(this.transform.parent.gameObject); hPlayerSidesColliderScriptCS.deactivateCollider(); //dont detect stumbles on death hInGameScriptCS.collidedWithObstacle(); //play the death scene } break; case BombType.BTBullet: { bDead = true; if (hControllerScriptCS.getBoss() != null) { move(this.transform.position, hControllerScriptCS.getBoss().position, 0.3f); } } break; } }
void OnCollisionEnter(Collision collision) { MoveForwardCS obj = (MoveForwardCS)collision.collider.GetComponent(typeof(MoveForwardCS)); if (obj != null) { obj.stop(); } else { obj = (MoveForwardCS)collision.collider.GetComponentInChildren(typeof(MoveForwardCS)); if (obj != null) { obj.stop(); } else { obj = (MoveForwardCS)collision.collider.transform.parent.GetComponent(typeof(MoveForwardCS)); if (obj != null) { obj.stop(); } } } hPlayerSidesColliderScriptCS.deactivateCollider(); //dont detect stumbles on death hInGameScriptCS.collidedWithObstacle(); //play the death scene }
/* * FUNCTION: Called when player hits an obstacle sideways * CALLED BY: PlayerSidesColliderScript.OnCollisionEnter() */ public void processStumble() { hCameraControllerCS.setCameraShakeImpulseValue(1); iLanePosition = iLastLanePosition; //stop strafe if (hEnemyControllerCS.processStumble()) { hInGameScriptCS.collidedWithObstacle(); //call death if player stumbled twice in unit time } else { if (!mecanimEnabled) { aPlayer.PlayQueued("run", QueueMode.CompleteOthers); } //enable colliders if they were disabled hPlayerFrontColliderScriptCS.activateCollider(); hPlayerSidesColliderScriptCS.activateCollider(); } }
void OnCollisionEnter(Collision collision) { hPlayerSidesColliderScriptCS.deactivateCollider(); //dont detect stumbles on death hInGameScriptCS.collidedWithObstacle(); //play the death scene }