Exemplo n.º 1
0
    private IEnumerator AbilityCooldown(Ability currentActive, AbilityDelegate methodToCall)
    {
        cooldownComplete = false;         // Deactivate button
        yield return(new WaitForSeconds(currentActive.cooldownTime));

        cooldownComplete = true;         // Reactivate button
    }
Exemplo n.º 2
0
    private IEnumerator AbilityDuration(Ability currentActive, AbilityDelegate methodToCall)
    {
        methodToCall();         // Activate skill
        yield return(new WaitForSeconds(currentActive.duration));

        methodToCall();         // Deactivate skill
    }
Exemplo n.º 3
0
    private IEnumerator AbilityCooldown(Ability currentActive, AbilityDelegate methodToCall)
    {
        cooldownComplete = false;         // Deactivate button
        GameManager.instance.ActionSkillCooldownDisplay(currentActive.cooldownTime);
        yield return(new WaitForSeconds(currentActive.cooldownTime));

        cooldownComplete = true;         // Reactivate button
    }
Exemplo n.º 4
0
 public PlayerAbility(string abilityName, AbilityTypeEnum abilityType, AbilityCategoryEnum abilityCategory, AbilityDelegate abilityAction, GameObject playerReference, bool isCommandPhaseMandatory = false)
 {
     AbilityName             = abilityName;
     AbilityType             = abilityType;
     AbilityAction           = abilityAction;
     AbilityCategory         = abilityCategory;
     PlayerReference         = playerReference;
     IsCommandPhaseMandatory = isCommandPhaseMandatory;
 }
Exemplo n.º 5
0
    public void ActivateAbility()
    {
        // If pressed and active ability assigned ...
        if (cooldownComplete)
        {
            // Disable active abilities until specific cooldown is complete
            switch (activeSkills)
            {
            case ActiveSkills.None:
                break;

            case ActiveSkills.DropMine:
                currentActive = activeAbilities[0];
                methodToCall  = playerCombat.PlaceDropMine;
                methodToCall();
                StartCoroutine(AbilityCooldown(currentActive, methodToCall));
                break;

            case ActiveSkills.Rewind:
                currentActive = activeAbilities[1];
                methodToCall  = playerRewind.Rewind;
                methodToCall();
                StartCoroutine(AbilityCooldown(currentActive, methodToCall));
                SoundManager.instance.PlaySFX("Rewind");

                break;

            case ActiveSkills.Shotgun:
                currentActive = activeAbilities[2];
                methodToCall  = playerCombat.ShotgunShoot;
                methodToCall();
                StartCoroutine(AbilityCooldown(currentActive, methodToCall));
                SoundManager.instance.PlaySFX("Shotgun");
                break;

            case ActiveSkills.Stealth:
                currentActive = activeAbilities[3];
                methodToCall  = Stealth;
                StartCoroutine(AbilityDuration(currentActive, methodToCall));
                StartCoroutine(AbilityCooldown(currentActive, methodToCall));
                SoundManager.instance.PlaySFX("Stealth");
                break;

            case ActiveSkills.TempShield:
                currentActive = activeAbilities[4];
                methodToCall  = TempShield;
                StartCoroutine(AbilityDuration(currentActive, methodToCall));
                StartCoroutine(AbilityCooldown(currentActive, methodToCall));
                break;

            default:
                break;
            }

            methodToCall = null;
        }
    }
Exemplo n.º 6
0
    public MonsterAbility(Ability ability, Monster owner)
    {
        Ability = ability;
        Owner   = owner;

        castingAmmo  = ability.castingAmmo;
        castingCount = ability.castingCount;
        abilityName  = ability.name;
        description  = ability.description;


        //get string of the name of the ability
        string name = string.Concat(ability.name.Where(c => !char.IsWhiteSpace(c)));

        //convert string to a delegate to call the method of the name of the ability
        abilityMethod = DelegateCreation(this, name);
    }
Exemplo n.º 7
0
    public void ActivateAbility()
    {
        // If pressed and active ability assigned ...
        if (cooldownComplete)
        {
            // Disable active abilities until specific cooldown is complete
            switch (activeSkills)
            {
            case ActiveSkills.None:
                break;

            case ActiveSkills.DropMine:
                currentActive = activeAbilities[0];
                break;

            case ActiveSkills.Rewind:
                currentActive = activeAbilities[1];
                break;

            case ActiveSkills.Shotgun:
                currentActive = activeAbilities[2];
                break;

            case ActiveSkills.Stealth:
                currentActive = activeAbilities[3];
                methodToCall  = Stealth;
                StartCoroutine(AbilityDuration(currentActive, methodToCall));
                StartCoroutine(AbilityCooldown(currentActive, methodToCall));
                break;

            case ActiveSkills.TempShield:
                currentActive = activeAbilities[4];
                methodToCall  = TempShield;
                StartCoroutine(AbilityDuration(currentActive, methodToCall));
                StartCoroutine(AbilityCooldown(currentActive, methodToCall));
                break;

            default:
                break;
            }

            methodToCall = null;
        }
    }
Exemplo n.º 8
0
    //create the method delegate for each ability
    AbilityDelegate DelegateCreation(object target, string functionName)
    {
        AbilityDelegate ab = (AbilityDelegate)Delegate.CreateDelegate(typeof(AbilityDelegate), target, functionName);

        return(ab);
    }
Exemplo n.º 9
0
 public ability(AbilityDelegate call)
 {
     this.call = call;
 }