Beispiel #1
0
    public override void RewardAtEpisodeEnds(UnitInspect inspector, GameSystem sys)
    {
        float AllDamaged = (inspector.getCurrentEnemys().Length <= 0)?0:inspector.AvgLives(inspector.getCurrentEnemys());

        //Rewarding globally
        foreach (GameObject knight in inspector.getInstantiatedKnights())
        {
            inspector.setScriptsFrom(knight);
            if (inspector.isScriptValid() && inspector.getScriptType() == "AgentScript")
            {
                BagReset();
                AddReward((1 - ((AllDamaged) / sys.AllInitLives)) * 2f);
                Apply(inspector.AgentScript);
            }
        }

        /*
         * //Rewarding reamined units
         * foreach(GameObject knight in inspector.getCurrentKnights()) {
         *  inspector.AgentAddRewardDircetly(1f);
         * }
         */
    }