Esempio n. 1
0
    public void SetCanvas(GameObject fish)
    {
        if (Fish != null)
        {
            //Fish.GetComponentInChildren<Renderer>().material.shader = Shader.Find("Diffuse");
            Fish.transform.FindChild("outline").GetComponent <SkinnedMeshRenderer>().enabled = false;
        }

        Fish = fish;

        //Fish.GetComponentInChildren<Renderer>().material.shader = Shader.Find("Self-Illumin/Outlined Diffuse");
        Fish.transform.FindChild("outline").GetComponent <SkinnedMeshRenderer>().enabled = true;

        //gameObject.SetActive (true);

        FishData fd = fish.GetComponent <FishData> ();

        if (fd.isSchoolLeader)
        {
            LeaderData.SetActive(true);
            FollowerData.SetActive(false);

            fd.GetNumberOfFish();

            TotalNodes.text   = fd.numberOfFollowers.ToString();
            WorkingNodes.text = fd.numberOfLivingFollowers.ToString();
            DeadNodes.text    = fd.numberOfDeadFollowers.ToString();

            TotalNodes.color   = fd.fishColor;
            WorkingNodes.color = fd.fishColor;
            DeadNodes.color    = fd.fishColor;

            LeaderData.GetComponent <Text> ().color = fd.fishColor;
        }
        else
        {
            LeaderData.SetActive(false);
            FollowerData.SetActive(true);

            MemoryUtilization.text = fd.GetMemoryUtilizationFormated();
            NumberCPU.text         = fd.cpuCount.ToString();
            LoadAverage.text       = fd.avgLoad.ToString();

            MemoryUtilization.color = fd.fishColor;
            NumberCPU.color         = fd.fishColor;
            LoadAverage.color       = fd.fishColor;

            FollowerData.GetComponent <Text> ().color = fd.fishColor;
        }
        FishName.GetComponent <Text> ().text  = fish.name;
        FishName.GetComponent <Text> ().color = fd.fishColor;
    }
Esempio n. 2
0
    void GUIdata(int windowID)
    {
        //data to display
        GUI.Label(new Rect(5, 0, windowSizeX - 10, lineSize), selectedFish.name);
        if (!data.isSchoolLeader)
        {
            //GUI.Label (new Rect (5, lineSize * 1, windowSizeX - 10, lineSize), "Dead? " + data.isDead.ToString ());
            GUI.Label(new Rect(5, lineSize * 1, windowSizeX - 10, lineSize), "Total memory utilization: " + data.GetMemoryUtilizationFormated());
            GUI.Label(new Rect(5, lineSize * 2, windowSizeX - 10, lineSize), "Total number of CPUs: " + data.cpuCount.ToString());
            GUI.Label(new Rect(5, lineSize * 3, windowSizeX - 10, lineSize), "Minute load average: " + data.avgLoad.ToString());
        }
        else
        {
            GUI.Label(new Rect(5, lineSize * 1, windowSizeX - 10, lineSize), "Number of Working Nodes: " + data.numberOfLivingFollowers);
            GUI.Label(new Rect(5, lineSize * 2, windowSizeX - 10, lineSize), "Number of Dead Nodes: " + data.numberOfDeadFollowers);
            GUI.Label(new Rect(5, lineSize * 3, windowSizeX - 10, lineSize), "Total Number of Nodes: " + data.numberOfFollowers);
        }

        /*
         * if (GUI.Button (new Rect(windowSizeX-lineSize,0,lineSize,lineSize), "X")) {
         *      showGUI = false;
         * }
         * if(GUI.Button(new Rect(windowSizeX*.1f,lineSize*5,windowSizeX*.8f,lineSize),"Kill fish")){
         *      data.KillFish();
         * }if(GUI.Button(new Rect(windowSizeX*.1f,lineSize*6,windowSizeX*.8f,lineSize),"Save fish")){
         *      data.ReviveFish();
         * }
         */
    }