/// <summary> /// Latch the specified controller on to the box. /// </summary> /// <param name="controller">Controller to latch.</param> /// <param name="direction">Direction of the latch.</param> private void Latch(RaycastCharacterController controller, RC_Direction direction) { BoxPuller puller = controller.GetComponent <BoxPuller>(); if (IsGrounded(groundedLookAhead) && (puller == null || puller.CanLatch(this))) { this.direction = direction; this.controller = controller; gameObject.layer = latchedLayer; } }
/// <summary> /// Unlatch the latched controller /// </summary> private void UnLatch() { if (controller != null) { BoxPuller puller = controller.GetComponent <BoxPuller>(); if (puller != null) { puller.ReleaseBox(); } } gameObject.layer = backgroundLayer; controller = null; }
private void Land() { isFalling = false; if (fallSpeed <= minSpeedForAction) { switch (fallDamageAction) { case FallDamageAction.STUN: controller.Stun(stunTime); break; case FallDamageAction.SEND_MESSAGE_DIE: controller.SendMessage("Die", null, SendMessageOptions.DontRequireReceiver); break; case FallDamageAction.SEND_MESSAGE_HIT: controller.SendMessage("Hit", fallSpeed, SendMessageOptions.DontRequireReceiver); break; case FallDamageAction.SIMPLE_HEALTH_DAMAGE: controller.GetComponent <SimpleHealth>().FallDamage(fallSpeed); break; } } fallSpeed = 0.0f; }
/// <summary> /// Latch the specified controller on to the box. /// </summary> /// <param name="controller">Controller to latch.</param> /// <param name="direction">Direction of the latch.</param> private void Latch(RaycastCharacterController controller, RC_Direction direction) { BoxPuller puller = controller.GetComponent<BoxPuller>(); if (IsGrounded(groundedLookAhead) && (puller == null || puller.CanLatch(this) )) { this.direction = direction; this.controller = controller; gameObject.layer = latchedLayer; } }