Beispiel #1
0
    IEnumerator dumpValues()
    {
        runDump = false;


        //bool anothFish = false;
        float closestFish = 1000.0f;

        //m_Vehicles = GameObject.Find ("Container").gameObject.GetComponent<CellSpacePartition> ().getVehicles ();
        int i = 0;

        for (; i < m_Vehicles.Count; i++)
        {
            if (m_Vehicles[i].gameObject.GetComponent <BallBounce>().getFishNumber() == 1)
            {
                break;
            }
        }

        if (m_Vehicles [i].GetComponent <BallBounce> ().getFishNumber() == 1)
        {
            tempScript = m_Vehicles [i].GetComponent <BallBounce> ();

            float tempColdness = Vector3.Distance(m_Vehicles [i].transform.position, hotLight.transform.position);

            double tempHunger = (double)tempScript.getHunger();
            double tempLibido = (double)tempScript.getLibido();


            int   state = tempScript.getState();
            float closestGoldFishFloat = 1000.0f;


            float closestFishFloat    = 1000.0f;
            float closestDolphinFloat = 1000.0f;


            if (tempScript.getAmberjack())
            {
                ////Debug.Log ("Entered Loop!!!"); Working!!!
                for (int j = 0; j < m_WanderList.Count; j++)
                {
                    //    if (m_WanderList[j] != null) {
                    BallBounce tempState = m_WanderList [j].GetComponent <BallBounce> ();

                    if (tempState.getKoi())
                    {
                        //bool areEqual = System.Object.ReferenceEquals (m_Vehicles [i], m_WanderList [j]);
                        //if (!areEqual) {
                        float temp = Vector3.Distance(m_Vehicles [i].transform.position, m_WanderList [j].transform.position);
                        if (temp < closestFishFloat)
                        {
                            closestFishFloat = temp;
                        }
                    }                     //here


                    if (tempState.getAmberjack())
                    {
                        bool areEqual = System.Object.ReferenceEquals(m_Vehicles [i], m_WanderList [j]);
                        if (!areEqual)
                        {
                            float temp = Vector3.Distance(m_Vehicles [i].transform.position, m_WanderList [j].transform.position);
                            if (temp < closestDolphinFloat)
                            {
                                closestDolphinFloat = temp;
                            }
                        }
                    }                     //here
                }
            }

            //File.AppendAllText(fileName, "\n\n\nFish's Number: "  + tempScript.getFishNumber().ToString() + "\n");

            //GUI.Label (new Rect(40, 510, 300, 20), "Fish's Hunger Level: ");
            File.AppendAllText(fileName, "hunger:" + tempScript.getHunger().ToString() + "\n");
            //GUI.Label (new Rect(40, 530, 20, 20), eatValue);

            //libidoValue = variables[3];

            //GUI.Label (new Rect(40, 550, 300, 20), "Fish's Libido Level: ");
            File.AppendAllText(fileName, "libido:" + tempScript.getLibido().ToString() + "\n");
            //GUI.Label (new Rect(40, 570, 20,20), libidoValue);

            File.AppendAllText(fileName, "distPrey:" + closestFishFloat.ToString() + "\n");

            File.AppendAllText(fileName, "distMate:" + closestDolphinFloat.ToString() + "\n");

            File.AppendAllText(fileName, "state:" + tempScript.getState().ToString() + "\n");

            File.AppendAllText(fileName, "timer:" + tempScript.getTimer().ToString() + "\n");

            File.AppendAllText(fileName, "coldness:" + tempColdness.ToString() + "\n");



            yield return(new WaitForSeconds(1));

            runDump = true;
        }
    }