Пример #1
0
    private void OnMeleeAttack()
    {
        if (InLag || !CanAttack)
        {
            return;
        }

        switch (machine.CurrentState)
        {
        case FORCE_FIELD_STATE:
            break;

        default:
            // attack
            nextSwingTime    = Time.time + SWING_COOLDOWN;
            ForceFacing      = Facing;
            forceFacingTimer = Melee.ATTACK_DURATION;
            meleeAudioSource.Play();
            if (actions.VerticalDirection > 0)
            {
                // up
                animator.SetTrigger("UpAttack");
                melee.Attack(Melee.AttackDirection.UP);
            }
            else if (actions.VerticalDirection < 0)
            {
                // down
                animator.SetTrigger("DownAttack");
                melee.Attack(Melee.AttackDirection.DOWN);
            }
            else
            {
                // forward
                animator.SetTrigger("Attack");
                melee.Attack(Melee.AttackDirection.FORWARD);
            }
            break;
        }
    }
Пример #2
0
 private static void MeleeAttacks(Melee fighter, Spellcaster caster)
 {
     caster.TakeDamage(fighter.Attack(), fighter.Name, fighter.GetType().ToString());
 }