示例#1
0
    /// <summary>
    /// This will spawn Forrest at the start marker
    /// </summary>
    public void RespawnForrest(int num)
    {
        GameObject[] grabPast = GameObject.FindGameObjectsWithTag("Passive");
        if (!slowMode)
        {
            // loop through the num count & spawn a every Forrest attempt for that day
            for (int i = 0; i < num; i++)
            {
                ForrestCTRL f = grabPast[i].GetComponent <ForrestCTRL>();

                // Set the position to be that of the starting sphere
                f.transform.position = new Vector3(startSp.transform.position.x, f.transform.position.y, startSp.transform.position.z);

                // Set the angle to be that of the starting sphere
                f.transform.eulerAngles = new Vector3(f.transform.eulerAngles.x, startSp.transform.eulerAngles.y, f.transform.eulerAngles.z);

                // Set the brain to the corresponding attention ini data
                f.SetBrain(attIniData[i]);

                //
                f.Reset();

                // Add the Forrest attemp to the list of All Forrest Attempts
                allFatt.Add(f);
            }

            // Need to clear & make way for a new day
            startFatt.Clear();

            // This will copy that list for later use
            for (int i = 0; i < allFatt.Count; i++)
            {
                startFatt.Add(allFatt[i]);
            }
        }
        else
        {
            //
            if ((int)attempt.x == (int)attempt.y - 1)
            {
                LearnFromAttempts();
                SetHighest();
                SetGraphs();
                attempt.x = -1;
                startFatt.Clear();
                day++;
            }
            attempt.x++;

            ForrestCTRL f = grabPast[(int)attempt.x].GetComponent <ForrestCTRL>();

            // Set the position to be that of the starting sphere
            f.transform.position = new Vector3(startSp.transform.position.x, f.transform.position.y, startSp.transform.position.z);

            // Set the angle to be that of the starting sphere
            f.transform.eulerAngles = new Vector3(f.transform.eulerAngles.x, startSp.transform.eulerAngles.y, f.transform.eulerAngles.z);

            // Set the brain to the corresponding attention ini data
            if (mode == GameMode.Train)
            {
                f.SetBrain(attIniData[(int)attempt.x]);
            }
            else if (mode == GameMode.Test)
            {
                f.SetBrain(attIniData[(int)attempt.x], mP.brains[(int)attempt.x].Split('\n')[0]);
            }

            allFatt.Add(f);
            startFatt.Add(f);

            //
            f.Reset();
        }
    }
示例#2
0
    /// <summary>
    /// This will spawn Forrest at the start marker
    /// </summary>
    public void SpawnForrest(int num)
    {
        if (!slowMode)
        {
            // loop through the num count & spawn a every Forrest attempt for that day
            for (int i = 0; i < num; i++)
            {
                ForrestCTRL f = Instantiate(forrest).GetComponent <ForrestCTRL>();

                // Set the position to be that of the starting sphere
                f.transform.position = new Vector3(startSp.transform.position.x, f.transform.position.y, startSp.transform.position.z);

                // Set the angle to be that of the starting sphere
                f.transform.eulerAngles = new Vector3(f.transform.eulerAngles.x, startSp.transform.eulerAngles.y, f.transform.eulerAngles.z);

                // Set the brain to the corresponding attention ini data
                if (mode == GameMode.Train)
                {
                    f.SetBrain(attIniData[i]);
                }
                else if (mode == GameMode.Test)
                {
                    f.SetBrain(attIniData[i], mP.brains[i].Split('\n')[0]);
                }
                else if (mode == GameMode.Campaign)
                {
                    string name = mP.campNN.Split('\n')[0];
                    string pass = mP.campNN.Split('\n')[1];

                    f.SetBrain(ParseBrain1(pass, 29), name);
                }

                // Add the Forrest attemp to the list of All Forrest Attempts
                allFatt.Add(f);
            }

            // Need to clear & make way for a new day
            startFatt.Clear();

            // This will copy that list for later use
            for (int i = 0; i < allFatt.Count; i++)
            {
                startFatt.Add(allFatt[i]);
            }
        }
        else
        {
            if (day == 0)
            {
                day++;
            }

            //
            if ((int)attempt.x == (int)attempt.y - 1)
            {
                LearnFromAttempts();
                SetHighest();
                SetGraphs();
                attempt.x = -1;
                startFatt.Clear();
                day++;
            }
            attempt.x++;

            ForrestCTRL f = Instantiate(forrest).GetComponent <ForrestCTRL>();

            // Set the position to be that of the starting sphere
            f.transform.position = new Vector3(startSp.transform.position.x, f.transform.position.y, startSp.transform.position.z);

            // Set the angle to be that of the starting sphere
            f.transform.eulerAngles = new Vector3(f.transform.eulerAngles.x, startSp.transform.eulerAngles.y, f.transform.eulerAngles.z);

            // Set the brain to the corresponding attention ini data
            if (mode == GameMode.Train)
            {
                f.SetBrain(attIniData[(int)attempt.x]);
            }
            else if (mode == GameMode.Test)
            {
                f.SetBrain(attIniData[(int)attempt.x], mP.brains[(int)attempt.x].Split('\n')[0]);
            }

            allFatt.Add(f);
            startFatt.Add(f);

            //
            f.Reset();
        }
    }