コード例 #1
0
 //Coroutine used for ability cooldown
 IEnumerator CooldownHandler(AbilityTest ability)
 {
     ARKLogger.LogMessage(eLogCategory.Combat, eLogLevel.System, ability.animationTag + " on " + ability.cooldown.ToString()+" second cooldown");
     ability.offCooldown = false;
     yield return new WaitForSeconds(ability.cooldown);
     ability.offCooldown = true;
     ARKLogger.LogMessage(eLogCategory.Combat, eLogLevel.System, ability.animationTag + " is off cooldown");
 }
コード例 #2
0
 public void PlayerCastedAbility(AbilityTest castedAbility)
 {
     if (castedAbility.offCooldown)
     {
         HandleCooldown(castedAbility);
         HandleEnergy(castedAbility.energy);
         corruptManager.ModifyMeter(castedAbility);
         HandleCorruption(castedAbility.cast);
     }
 }
コード例 #3
0
 public void ModifyMeter(AbilityTest castedAbil)
 {
     if (castedAbil.cast == eAbilityCast.Light) {
         corruptionMeter += castedAbil.corruption;
         stageCorLevel += castedAbil.corruption;
     } else {
         corruptionMeter -= castedAbil.corruption;
         stageCorLevel += castedAbil.corruption;
     }
     if (corruptionMeter > 100) corruptionMeter = 100;
     if (corruptionMeter < 0) corruptionMeter = 0;
     if (corruptionMeter + corruptionLevel >= corruptionThresh) corrupted = true;
 }
コード例 #4
0
 //Casts players ability
 private void CastAbility(AbilityTest ability)
 {
     //Check to see ability is off cooldown
     if (ability.offCooldown && (player.playerHUD.energySlider.value - ability.energy) > 0)
     {
         //play the correct animation
         anim.Play(ability.animationTag, 0);
         //set the correct trigger
         meleeAttackTrigger.enabled = true;
         //update the triggers damage with abilities damage
         meleeAttackTrigger.SendMessage(CombatActions.UpdateDamage, ability.damage);
         player.playerHUD.PlayerCastedAbility(ability);
         StartCoroutine(CooldownHandler(ability));
     }
     else
     {
         string message = ability.animationTag + " not off ability cooldown yet!";
         ARKLogger.LogMessage(eLogCategory.Combat, eLogLevel.Warning, message);
     }
 }
コード例 #5
0
    //on player load setup abilities
    void Start()
    {
        energyRegen = 5.0f;
        corruptionDegen = 1.0f;

        #region Ability setup
        //Abilities(damage, cooldown, InputTag, sprite image)
        attack1 = new AbilityTest(eEquippedSlot.Attack1, eAbilityCast.Light,
                                5, 0.25f, 0, 5, Resources.Load<Sprite>("Sprites/Demon/Abilities/BasicAttacks/BasicAttack1"));

        attack2 = new AbilityTest(eEquippedSlot.Attack2, eAbilityCast.Dark,
                                10, 3f, 5, 20, Resources.Load<Sprite>("Sprites/Demon/Abilities/BasicAttacks/BasicAttack1"));

        spell1 = new AbilityTest(eEquippedSlot.Spell1, eAbilityCast.Light,
                                20, 5f, 10, 20, Resources.Load<Sprite>("Sprites/Demon/Abilities/BasicAttacks/BasicAttack1"));

        spell2 = new AbilityTest(eEquippedSlot.Spell2, eAbilityCast.Dark,
                                25, 5f, 20, 25, Resources.Load<Sprite>("Sprites/Demon/Abilities/BasicAttacks/BasicAttack1"));

        spell3 = new AbilityTest(eEquippedSlot.Spell3, eAbilityCast.Dark,
                                40, 10f, 30, 50, Resources.Load<Sprite>("Sprites/Demon/Abilities/BasicAttacks/BasicAttack1"));

        ultimate = new AbilityTest(eEquippedSlot.Ultimate, eAbilityCast.Light,
                                80, 60f, 60, 80, Resources.Load<Sprite>("Sprites/Demon/Abilities/BasicAttacks/BasicAttack1"));

        #endregion
    }
コード例 #6
0
 // Handles cooldown values for players skill bar
 private void HandleCooldown(AbilityTest ability)
 {
     SkillBarElement hudElement = DetermineHudElement(ability.equippedSlot);
     StartCoroutine(CooldownHandler(ability, hudElement));
 }
コード例 #7
0
 // Coroutine used for ability cooldown
 IEnumerator CooldownHandler(AbilityTest ability, SkillBarElement hudElement)
 {
     hudElement.image.color = Color.black;
     yield return new WaitForSeconds(ability.cooldown);
     hudElement.image.color = Color.white;
 }