Пример #1
0
    void LoadNSetHaxbot(int i)
    {
        if (GM.botsExist)
        {
            dd_Haxbot[i].gameObject.SetActive(true);
            int chosen = GM.haxBotChoice[i];

            hbD[i]       = HXB.LoadHaxbot(bot[i], dd[chosen].text);
            name[i].text = hbD[i].name;
            GM.hbName[i] = hbD[i].name;

            //
            for (int j = 0; j < 2; j++)
            {
                foreach (Renderer r in bot[j].GetComponentsInChildren <Renderer>())
                {
                    r.material.SetTexture(GM.mainTexture, hbD[j].txt2d);
                }
            }
        }
        else
        {
            dd_Haxbot[i].gameObject.SetActive(false);
        }
    }
Пример #2
0
    void QuickLoad()
    {
        HaxbotData hbD = HXB.LoadHaxbot(gameObject, who);

        //
        for (int j = 0; j < 2; j++)
        {
            foreach (Renderer r in gameObject.GetComponentsInChildren <Renderer>())
            {
                r.material.SetTexture(GM.mainTexture, hbD.txt2d);
            }
        }
    }
Пример #3
0
    void Start()
    {
        GameObject.Find("vText").GetComponent <TextMeshProUGUI>().text = $"v{Application.version}";

        GenerateAudience(GM.attendence);
        dist   = .5f;
        angleX = 0;
        angleY = 0;

        for (int i = 0; i < graph.Length; i++)
        {
            graph[i]          = new Graph(graphObj[i], accumulative: true);
            totalGraph[i]     = new Graph(tGraphObj[i], accumulative: false);
            totalGraphMini[i] = new Graph(tGraphObjM[i], accumulative: false);
        }

        theRound.text = $"{GM.currentRound + 1}/{GM.totalRounds}";

        //
        AddToNextWaffleSpawn();

        //
        txtBattle = new Material[] { Resources.Load <Material>("Mats/attack"), Resources.Load <Material>("Mats/defend"), Resources.Load <Material>("Mats/taunt") };

        //
        txtDecide = new Material[] { Resources.Load <Material>("Mats/random"), Resources.Load <Material>("Mats/nn") };

        //
        map = new Map(this, levelName);

        // We dont want to see this pesky button in the heat of battle
        if (GM.currentRound > 0)
        {
            start.gameObject.SetActive(false);
        }
        else
        {
            GM.FullReset();

            map.SetCamTo(Map.CamMode.Field);
        }

        //
        for (int i = 0; i < fighter.Length; i++)
        {
            GM.intelli[i].SetShowoff(GM.explSetter[i]);
            txtAiName[i].text = $"{(GM.isForrest[i] ? "Forrest" : GM.intelli[i].aiName)} - {GM.explSetter[i] * 100}%";

            //
            if (GM.currentRound > 0)
            {
                //
                for (int j = 0; j < GM.currentRound; j++)
                {
                    totalGraphMini[i].AddValueToGraph(GM.battleAvg[i][j]);
                }

                totalGraphMini[i].UpdateGraph();
                txtTGraphMaxMini[i].text = $"{(Mathf.Round(totalGraphMini[i].performance * 1000)) / 1000}";
            }
        }


        hbD[0] = HXB.LoadHaxbot(one, GM.botsExist ? GM.hbName[0] : "");
        hbD[1] = HXB.LoadHaxbot(two, GM.botsExist ? GM.hbName[1] : "");

        //
        fighter[0] = new Fighter(one, 0, map.mapSize, GM.intelli[0]);
        fighter[1] = new Fighter(two, 1, map.mapSize, GM.intelli[1]);

        // to prevent memory leaks, lets take care of our garbage collector
        Resources.UnloadUnusedAssets();
        System.GC.Collect();

        //
        for (int i = 0; i < 2; i++)
        {
            if (GM.isForrest[i])
            {
                fighter[i].ForrestOverride();
            }
            else
            {
                foreach (Renderer r in fighter[i].obj.GetComponentsInChildren <Renderer>())
                {
                    r.material.SetTexture(GM.mainTexture, hbD[i].txt2d);
                }
            }
        }

        //
        for (int i = 0; i < fighter.Length; i++)
        {
            if (fighter[i].config.isHuman)
            {
                humansInvolved[i] = true;
            }
        }

        //
        fighter[0].SetOpponent(fighter[1]);
        fighter[1].SetOpponent(fighter[0]);

        //
        fighter[0].LookAtOpponent();
        fighter[1].LookAtOpponent();

        //
        map.SetFighters(fighter);

        //
        aS = gameObject.AddComponent <AudioSource>();

        //
        for (int i = 0; i < 2; i++)
        {
            outp[i] = Map.OutputLocation(map, fighter[i].expression, fighter[i == 0 ? 1 : 0].expression, dist, angleX, angleY);
            gIsLearningBrain[i].SetActive(GM.nnIsLearning[i]);
        }

        //
        foreach (Tile ve in map.loc)
        {
            if (!ve.free)
            {
                Color      c = ve.type == 'w' ? new Color(.75f, .25f, 0) : Color.black;
                GameObject g = null;
            }
        }
    }