protected override void Update()
        {
            if (playerHealth != null && playerHealth.GetPercentage() < 50f)
            {
                playerHealth.GainAttribute(100f);
            }
            if (playerMana != null && playerMana.GetPercentage() < 20f)
            {
                playerMana.GainAttribute(50f);
            }


            Quest quest = Quest.GetByName("Setting out");

            if (questList.HasQuest(quest) && !isFading)
            {
                isFading = true;
                StartCoroutine(EndTutorialFade(1f));
            }
            if (Input.GetKeyDown(KeyCode.Tab))
            {
                quest = Quest.GetByName("Understanding your skills");
                // if (questList.HasObjectiveCompleted(quest, "Use Punch"))
                if (atkCounter == 6 && !questList.HasQuestCompleted("Understanding your skills"))
                {
                    questList.CompleteObjective(quest, "Finish the demonstration");
                    playerGO.GetComponent <PlayerConversant>().Quit();
                }
            }
        }
示例#2
0
        private bool AttackInQueue()
        {
            isFromQueue = false;
            KeyValuePair <FollowerAttackName, int> attackAndCost;
            // Check player HP threshold over attack queue
            float hp   = playerHealth.GetPercentage();
            float mana = playerMana.GetAttributeValue();

            if (hp <= healThreshold)
            {
                FollowerAttackPool[] healSkills = new FollowerAttackPool[2]
                {
                    FollowerAttackPool.HealBig,
                    FollowerAttackPool.HealSmall
                };

                foreach (var heal in healSkills)
                {
                    attackAndCost = attackManager.GetAttackCost(heal);
                    if (!IsOnCooldown(attackAndCost.Key) && attackAndCost.Value <= mana)
                    {
                        currentAttack    = attackAndCost.Key;
                        resourceTypes    = new IAttribute[1];
                        resourceTypes[0] = playerHealth as IAttribute;
                        return(true);
                    }
                }
            }

            // Check player mana
            if (playerMana.GetPercentage() <= manaThreshold && attackManager.HasAttackInPool(FollowerAttackPool.ManaGain))
            {
                attackAndCost = attackManager.GetAttackCost(FollowerAttackPool.ManaGain);
                if (!IsOnCooldown(attackAndCost.Key))
                {
                    currentAttack    = attackAndCost.Key;
                    resourceTypes    = new IAttribute[2];
                    resourceTypes[0] = playerMana as IAttribute;
                    resourceTypes[1] = selfMana as IAttribute;
                    return(true);
                }
            }

            // Check for lower priority heal over time threshold
            if (hp < regenThreshold)
            {
                attackAndCost = attackManager.GetAttackCost(FollowerAttackPool.HealOverTime);
                if (!IsOnCooldown(attackAndCost.Key) && !IsAttackQueued(attackAndCost.Key))
                {
                    atkQueue.Enqueue(attackAndCost.Key);
                }
            }

            if (atkQueue.Count > 0)
            {
                currentAttack = atkQueue.Peek();
                if (!IsOnCooldown(currentAttack))
                {
                    isFromQueue = true;
                    return(true);
                }
                Debug.Log("Attack in queue is on cooldown? " + currentAttack);
            }

            return(false);
        }