예제 #1
0
    private bool AttackTarget(IAttackable player, bool damageOnDraw = false)
    {
        InCombat    = true;
        actionTimer = attackAnimationTime;
        Lock();

        Equipment.ShowWeapon();

        var weapon     = Inventory.GetEquipmentOfCategory(ItemCategory.Weapon);
        var weaponAnim = weapon?.Type.GetAnimation() ?? 0;

        if (!playerAnimations.IsAttacking() || lastTrainedSkill != Skill.Fighting)
        {
            lastTrainedSkill = Skill.Fighting;
            playerAnimations.StartCombat(weaponAnim);
            if (!damageOnDraw)
            {
                return(true);
            }
        }

        playerAnimations.Attack(weaponAnim);

        transform.LookAt(player.Transform);
        StartCoroutine(DamageEnemy(player));
        return(true);
    }