public void OpenMenuPanel(UIElementCollection panel)
 {
     panel.SetCollectionState(UITransition.State.Enable);
 }
 public void CloseMenuPanel(UIElementCollection panel)
 {
     panel.SetCollectionState(UITransition.State.Disable);
 }
Exemple #3
0
    private void Update()
    {
        if (sr != null)
        {
            if (sr.canvasCollection.partyPanelOpenForBattle)
            {
                if (Level < sr.database.LevelCap)
                {
                    ExpAddCurrent -= Time.deltaTime;
                    if (ExpAddCurrent < 0)
                    {
                        ExpAddCurrent += ExpAddEvery;
                        if (ExpToAdd > 0)
                        {
                            int maxExpPerTick = (Exp.z - Exp.y) / FractionOfExp;
                            if (maxExpPerTick == 0)
                            {
                                maxExpPerTick = 1;
                            }
                            if (maxExpPerTick >= (Exp.z - Exp.x)) //If next exp tick goes over or equals next
                            {
                                if (ExpToAdd >= (Exp.z - Exp.x))  //If exp recieved is greater than or equal to next level
                                {
                                    ExpToAdd -= (Exp.z - Exp.x);  //Subtract exp from pool
                                    Exp.x    += (Exp.z - Exp.x);  //Add from pool to exp total
                                    LevelUp();
                                }
                                else
                                {
                                    Exp.x   += ExpToAdd; //Finish off exp pool
                                    ExpToAdd = 0;        //Set exp pool to zero.
                                }
                            }
                            else
                            {
                                if (ExpToAdd >= maxExpPerTick) //If exp recieved is greater than or equal to max pool per tick
                                {
                                    ExpToAdd -= maxExpPerTick; //Subtract exp from pool
                                    Exp.x    += maxExpPerTick; //Add from pool to exp total
                                }
                                else
                                {
                                    Exp.x   += ExpToAdd; //Finish off exp pool
                                    ExpToAdd = 0;        //Set exp pool to zero.
                                }
                            }
                        }
                    }
                }
            }
            if (sr.director.DirectorDeltaTime != 0 && LunenOut && LunenOrder < sr.director.MaxLunenOut)
            {
                if (CurrCooldown > 0f)
                {
                    if (CurrCooldown > GetMaxCooldown())
                    {
                        CurrCooldown = GetMaxCooldown();
                    }
                    CurrCooldown -= sr.director.DirectorDeltaTime;
                    CooldownDone  = false;
                }
                else
                {
                    if (!CooldownDone)
                    {
                        //This is the point where the cooldown finishes. There's a lot to program here.
                        CalculateStats();
                        TickUpMoveCooldowns();
                        sr.canvasCollection.ScanParty(MonsterTeam);
                        if (MonsterTeam == Director.Team.EnemyTeam && sr.director.PlayerLunenAlive.Count != 0)
                        {
                            //StartAI
                            if (!(bool)sr.database.GetTriggerValue("BattleVars/LunenAttacking"))
                            {
                                PerformAction(AIScripts.StartDecision(sr, this));
                                CooldownDone = true;
                            }
                        }
                        else if (MonsterTeam != Director.Team.EnemyTeam)
                        {
                            sr.soundManager.PlaySoundEffect("LunenCooldownDone");
                            CooldownDone = true;
                        }
                        if (EndOfTurnDamage > 0)
                        {
                            TakeDamage(EndOfTurnDamage);
                        }
                    }
                    else
                    {
                        if (MonsterTeam != Director.Team.EnemyTeam)
                        {
                            currentuiec.SetCollectionState(UITransition.State.Enable);
                        }
                        CurrCooldown = 0f;
                    }
                }


                if (HealthToSubtract > 0)
                {
                    int maxHPPerTick = (Health.x + Health.y) / FractionOfHealth;
                    if (maxHPPerTick == 0)
                    {
                        maxHPPerTick = 1;
                    }
                    if (PlayHurtSFX)
                    {
                        if (HealthToSubtract < Health.z)
                        {
                            if (PlayHurtSFXType > 1)
                            {
                                sr.soundManager.PlaySoundEffect("LunenHurtSuper");
                            }
                            else if (PlayHurtSFXType < 1)
                            {
                                sr.soundManager.PlaySoundEffect("LunenHurtLesser");
                            }
                            else
                            {
                                sr.soundManager.PlaySoundEffect("LunenHurtNormal");
                            }
                        }

                        PlayHurtSFX = false;
                    }
                    if (HealthToSubtract > maxHPPerTick)  //If exp recieved is greater than or equal to max pool per tick
                    {
                        HealthToSubtract -= maxHPPerTick; //Subtract exp from pool
                        Health.z         -= maxHPPerTick; //Add from pool to exp total
                    }
                    else
                    {
                        Health.z        -= HealthToSubtract; //Finish off exp pool
                        HealthToSubtract = 0;                //Set exp pool to zero.
                        PlayHurtSFX      = true;
                    }
                    if (Health.z <= 0)
                    {
                        if (sr != null)
                        {
                            sr.director.LunenHasDied(this);
                        }
                        HealthToSubtract = 0;
                        //if (MonsterTeam == Director.Team.EnemyTeam) Destroy(gameObject);
                    }
                }
            }
        }
    }