Exemple #1
0
 public void GetInput()
 {
     JumpPress = inputListener.JumpButtonPress();
     JumpHold  = inputListener.JumpButtonHold();
     AxisH     = inputListener.SmoothAxisX();
     AxisV     = inputListener.AxisY();
     if (AxisH != 0)
     {
         facingDirection = (int)Mathf.Sign(AxisH);
     }
 }
    void OnTriggerStay2D(Collider2D other)
    {
        if (damageCountdown > 0)
        {
            switch (other.tag)
            {
            case "Player":
                PlayerHealth    playerHealth     = other.GetComponent <PlayerHealth>();
                ActorPlayer     otherActorPlayer = other.GetComponent <ActorPlayer>();
                VibrateJoystick otherJoystick    = other.GetComponent <VibrateJoystick>();
                //Debug.Log("Hurt Player" + actorPlayer.input.facingDirection);
                playerHealth.Hurt(0, new Vector2(actorPlayer.inpt.facingDirection * 15 * DirectionalPush.x, input.AxisY() * DirectionalPush.y));
                otherJoystick.SetVibrating(true);
                otherActorPlayer.isStunned = true;
                jet.SmallRefill();
                break;

            case "Enemy":
                EnemyHealth enemyHealth = other.GetComponent <EnemyHealth>();
                if (enemyHealth != null)
                {
                    //Debug.Log("Hurt Enemy" + actorPlayer.input.facingDirection);
                    enemyHealth.Hurt(damage, actorPlayer.input.facingDirection);
                }
                break;
            }
        }
    }