Ejemplo n.º 1
0
    /// <summary>
    /// Triggers the death actions.
    /// </summary>
    /// <returns>The zero health action.</returns>
    protected IEnumerator DoZeroHealthAction()
    {
        if (zeroHealthAction == ZeroHealthAction.SEND_MESSAGE_DIED)
        {
            SendMessage("Died", SendMessageOptions.DontRequireReceiver);
        }
        else
        {
            controller.Stun(dieDelay * 1.25f);
            controller.Velocity = new Vector2(0.0f, 10.0f);
            int tmpBackgroundLayer  = controller.backgroundLayer;
            int tmpPassThroughLayer = controller.passThroughLayer;
            int tmpClimableLayer    = controller.climableLayer;
            controller.backgroundLayer  = 999;
            controller.passThroughLayer = 999;
            controller.climableLayer    = 999;
            yield return(new WaitForSeconds(dieDelay));

            controller.backgroundLayer  = tmpBackgroundLayer;
            controller.passThroughLayer = tmpPassThroughLayer;
            controller.climableLayer    = tmpClimableLayer;
            controller.Velocity         = Vector2.zero;
            switch (zeroHealthAction)
            {
            case ZeroHealthAction.RELOAD_SCENE: Application.LoadLevel(Application.loadedLevel); break;

            case ZeroHealthAction.RESPAWN: health = maxHealth; RespawnPoint2D.Respawn(controller); break;
            }
        }
    }
Ejemplo n.º 2
0
 /// <summary>
 /// Stand on a respawn point to activate it. You could play a particle effect of something here.
 /// </summary>
 override public void DoAction(RaycastCollider2D collider, RaycastCharacterController2D character)
 {
     if (collider.direction == RC_Direction.DOWN)
     {
         currentRespawnPoint = this;
     }
 }
Ejemplo n.º 3
0
	/// <summary>
	/// Stand on a respawn point to activate it. You could play a particle effect of something here.
	/// </summary>
	override public void DoAction(RaycastCollider2D collider, RaycastCharacterController2D character) {
		if (collider.direction == RC_Direction.DOWN) currentRespawnPoint = this;
	}