Exemplo n.º 1
0
    public void Update()
    {
        if (!ScenesController.SControl.isLocked)
        {
            for (int i = 0; i < 5; i++)
            {
                PlayerSpell[i].Update();
            }

            InteruptUpdate();
            DispelUpdate();

            PC_Picking();

            buffSystem.SortBuffs();
            buffSystem.ActivateBuffs();

            if (!GameFinished)
            {
                spellCastHandler.Update();
            }

            myCaster.ManaRegeneration();

            if ((troopsHandler.SoldierAmount <= 0) && (!GameFinished))
            {
                Lose();
            }

            if (GameFinished)
            {
                if (isVictorious)
                {
                    if (!itemReceived)
                    {
                        GameEnding();
                    }
                    else
                    {
                        ExperienceTransfer();
                    }

                    if (expTranferDone)
                    {
                        if (endingTimer-- <= 0)
                        {
                            chosenAdventure.progress++;

                            ClearCore();
                            chosenAccount.SaveAccData();
                            if (chosenAdventure.progress >= WorldMapCore.WMCore.adventureInfoHandler.adventureInfo[chosenAdventure.ID].encountersInfo.amount)
                            {
                                chosenAccount.myProgress.missionComplete[chosenAdventure.ID] = true;
                                ScenesController.SControl.SwitchScene("AdventureScene");
                            }
                            else
                            {
                                ScenesController.SControl.SwitchScene("DescendantScene");
                            }
                        }
                    }
                }
                else
                {
                    GameEnding();
                    if (!itemReceived)
                    {
                        ClearCore();
                        ScenesController.SControl.SwitchScene("DescendantScene");
                    }
                }
            }
            else
            {
                myEnemy.Update();
                _mytip.transform.GetChild(0).GetComponent <Text>().text = recount.GetRecount();
            }
        }
    }
Exemplo n.º 2
0
    private void ExperienceTransfer()
    {
        if (myTip == null)
        {
            myTip = Tooltip.Show("", 0, new Vector3(0, 0, 0), false);
            for (int i = 0; i < tempRecount.amount; i++)
            {
                conversionValue[i] = Mathf.Max(8, Mathf.Min(tempRecount.entry[i].healing, tempRecount.entry[i].overhealing / 3) / 120);
            }
            ClearScene();
        }
        myTip.UpdateContent(tempRecount.GetRecount(true) + "\n\n Experience gained: " + tempExpGained + "\n\nLevel: " + chosenAccount.level + "\n" + chosenAccount.GetExpString() + chosenAccount.tempLevelUp);
        if (!overhealingPenaltyDone) // zmniejszamy healing o nasz overhealing
        {
            int doneamount = 0;

            for (int i = 0; i < tempRecount.amount; i++)
            {
                if (tempRecount.entry[i].overhealing > 0)
                {
                    if (tempRecount.entry[i].healing > 0)
                    {
                        tempRecount.entry[i].healing     = Mathf.Max(tempRecount.entry[i].healing - conversionValue[i], 0);
                        tempRecount.entry[i].overhealing = Mathf.Max(tempRecount.entry[i].overhealing - conversionValue[i] * 3, 0);
                    }
                    else
                    {
                        tempRecount.entry[i].overhealing = 0;
                    }
                }
                else
                {
                    doneamount++;
                }
            }

            if (doneamount >= tempRecount.amount)
            {
                overhealingPenaltyDone = true;
                conversionValue2       = Mathf.Max(8, tempRecount.entry[actualEntry].healing / 120);
            }
        }
        else
        if (!expTranferDone)
        {
            if (actualEntry < tempRecount.amount)
            {
                if (tempRecount.entry[actualEntry].healing > 0)
                {
                    tempRecount.entry[actualEntry].healing = Mathf.Max(tempRecount.entry[actualEntry].healing - conversionValue2, 0);
                    tempExpGained     += conversionValue2;
                    chosenAccount.Exp += conversionValue2;
                }
                else
                {
                    actualEntry++;
                    if (actualEntry < tempRecount.amount)
                    {
                        conversionValue2 = Mathf.Max(8, tempRecount.entry[actualEntry].healing / 120);
                    }
                }
            }
            else
            {
                expTranferDone = true;
            }
        }
    }