Esempio n. 1
0
        public void Update()
        {
            if (gameObject.GetComponent <CharacterMaster>() is CharacterMaster characterMaster)
            {
                trackerMaster = characterMaster;
                if (trackerMaster.GetBody() is CharacterBody characterBody)
                {
                    trackerBody = characterBody;
                    int tempCurseCount = 0;

                    foreach (AffixTracker tracker in affixTrackers)
                    {
                        //If the buff is StageLock or CurseLock, give it to me
                        if (tracker.isCurseLock || tracker.isStageLock)
                        {
                            //trackerBody.AddBuff(tracker.buffIndex);
                            trackerBody.ApplyBuff(tracker.buffIndex, 1);
                        }
                        //If neither Lock, and also not Held nor Vulture, take it away
                        else if (!tracker.isHeld && !tracker.isVultured)
                        {
                            //trackerBody.RemoveBuff(tracker.buffIndex);
                            trackerBody.ApplyBuff(tracker.buffIndex, 0);
                        }

                        //Check is the buff is currently from Wake of Vultures
                        if (tracker.isVultured)
                        {
                            //Reduce the amount of time and remove flag if no time left
                            tracker.vultureTimeLeft -= Time.deltaTime;
                            if (tracker.vultureTimeLeft <= 0)
                            {
                                tracker.isVultured = false;
                            }
                        }

                        //Calculate the current curse count
                        if (tracker.isCurseLock)
                        {
                            //If its cursed and neither staged nor held nor vultured, add a curse
                            if (!tracker.isHeld && !tracker.isStageLock && !tracker.isVultured)
                            {
                                tempCurseCount++;
                            }
                        }
                    }
                    //Update curse count if its changed
                    if (tempCurseCount != curseCount)
                    {
                        curseCount = tempCurseCount;
                        //Chat.AddMessage("Current Curse Level is: " + curseCount.ToString());
                    }
                    //Update the visual effect if needed
                    if (trackerBody.GetBuffCount(CurseBuff.index) != curseCount)
                    {
                        trackerBody.ApplyBuff(CurseBuff.index, curseCount);
                    }
                }
            }
        }