public void Attack(KeyCode button, Direction dir)
    {
        holdAttack = true;

        if (state != State.IDLE)
        {
            return;
        }
        attackDir = (dir == Direction.NONE) ? E.ToDirection(mgMovement.GetCurrentDirection()) : dir;
        AttackType type = (button == Controls.player_attack2) ? AttackType.STAB : AttackType.SLASH;

        attack          = GetAttack(type, attackDir);
        attackAnim      = GetAttackAnim(type, dir);
        attackAnimRight = !attackAnimRight;
    }
Example #2
0
    public void FacePlayer(bool towards)
    {
        var d = GetDirectionToPlayer();

        if (towards)
        {
            if (mgMovement.GetCurrentDirection() != d)
            {
                mgMovement.MoveDirection(d);
            }
        }
        else
        {
            if (mgMovement.GetCurrentDirection() == d)
            {
                mgMovement.MoveDirection(E.Opposite(d));
            }
        }
    }
Example #3
0
 void Dash()
 {
     mgMovement.SetSpeed(speedDash);
     mgJump.SetFloating(true);
     Stun(timeDash, mgMovement.GetCurrentDirection());
     MakeInvincible(timeDash);
     dashing   = true;
     hasDashed = true;
     cdDash    = Time.time + cdbDash;
     cdDashEnd = Time.time + timeDash;
 }