Esempio n. 1
0
 public override void AcademyStep()
 {
     if (!IsDone() && sys.battleStarted)
     {
         GameObject[] units = inspector.getCurrentUnits();
         foreach (GameObject unit in units)
         {
             if (inspector.setScriptsFrom(unit))
             {
                 if (inspector.getScriptType() == "AgentScript" && !inspector.isDead())
                 {
                     inspector.AgentDescisionRequest();
                     inspector.AgentAlwaysUpdate();
                 }
             }
         }
         //Enviromental Upadte
         sys.Academy_Update();
         if ((sys.knightNumber <= 0 || sys.enemyNumber <= 0) && !onceInStep)
         {
             //On End
             rewardSys.RewardAtEpisodeEnds(inspector, sys);
             onceInStep = true;
             Done();
         }
     }
     else if (IsDone())
     {
         int    knightlen = inspector.getCurrentKnights().Length;
         int    enemylen  = inspector.getCurrentEnemys().Length;
         string endstring = (knightlen > 0 && enemylen <= 0)?"Knight win":(enemylen > 0 && knightlen <= 0)?"Enemy win":(enemylen <= 0 && knightlen <= 0)?"Draw":(enemylen > 0 && knightlen > 0)?"Step Max reached":"Unknown state";
         Debug.Log($"{endstring} KnightAvgHP:{inspector.AvgLives(inspector.getCurrentKnights())} / EnemyAvgHP:{inspector.AvgLives(inspector.getCurrentEnemys())}");
     }
 }