예제 #1
0
    /// <summary>
    /// Executes the active ability that is currently equipped.
    /// </summary>
    private void UseCurrentAbility()
    {
        // if equipped ability on cooldown
        if (IsCurrentAbilityOnCooldown())
        {
            // DONT continue code
            return;
        }

        // get currently equipped ability
        ActiveAbility currentAbility = GetCurrentActiveAbility();

        // if have an ability equipped
        if (currentAbility != null)
        {
            // start cooldown timer for current ability
            abilityIdToCooldownTimer[currentAbility.abilityId] = new StopTimer(
                currentAbility.GetTrueActiveAbilityCooldownTime());

            // get current surface-level character data
            CharacterData frontFacingCharData = GeneralMethods.GetFrontFacingCharacterDataFromCharMaster(
                _characterMasterController);

            // spawn and setup an active ability object
            SpawnAbilityPrefab(currentAbility, frontFacingCharData);

            // call ability use actions if NOT null
            OnActiveAbilityUseAction?.Invoke();
        }
    }