public void whichFiducial(string fiducial)
    {
        if (fiducial == "cup")
        {
            currentfiducialtracked = "cup";
        }
        else if (fiducial == "orange")
        {
            currentfiducialtracked = "orange";
        }

        if (currentfiducialtracked == lastfiducialtracked)
        {
            // Do nothing
        }
        else
        {
            lastCup    = null;
            lastOrange = null;
        }
        //    if (fiducial == "postit") {
        //     currentfiducialtracked = "postit";
        //    }
    }
 void Start()
 {
     lastCup             = null;
     lastOrange          = null;
     lastfiducialtracked = "null";
 }
    //CHANNEL ORANGE
    void FindClosestOrange()
    {
        orange     northside;
        orange     eastside;
        orange     southside;
        orange     westside;
        GameObject northWindow = GameObject.Find("orangeFiducial/orangeNorth");
        GameObject eastWindow  = GameObject.Find("orangeFiducial/orangeEast");
        GameObject southWindow = GameObject.Find("orangeFiducial/orangeSouth");
        GameObject westWindow  = GameObject.Find("orangeFiducial/orangeWest");

        northside = northWindow.GetComponent <orange>();
        eastside  = eastWindow.GetComponent <orange>();
        southside = southWindow.GetComponent <orange>();
        westside  = westWindow.GetComponent <orange>();

        // calculate closest distance
        float distanceToClosestOrange = Mathf.Infinity;

        orange closestEnemy = null;

        orange[] allEnemies = GameObject.FindObjectsOfType <orange>();

        foreach (orange currentEnemy in allEnemies)
        {
            float distanceToEnemy = (currentEnemy.transform.position - this.transform.position).sqrMagnitude;
            if (distanceToEnemy < distanceToClosestOrange)
            {
                distanceToClosestOrange = distanceToEnemy;
                closestEnemy            = currentEnemy;
            }
        }

        orange currentOrange = closestEnemy;

        if (currentOrange == lastOrange)
        {
            // GameObject mainCamera = GameObject.Find("Main Camera");
            // AnalogGlitch glitchy = mainCamera.GetComponent <AnalogGlitch> ();
            // glitchy.setGlitchboolean(false);
        }
        else
        {
            if (currentOrange == southside)
            {
                GameObject   mainCamera = GameObject.Find("Main Camera");
                AnalogGlitch glitchy    = mainCamera.GetComponent <AnalogGlitch> ();
                glitchy.setGlitchboolean(true);


                for (int i = 1; i < SceneManager.sceneCount; i++)
                {
                    Scene currentscene = SceneManager.GetSceneAt(i);
                    Debug.Log("Current SCENE is '" + currentscene.name + "'.");
                    SceneManager.UnloadSceneAsync(currentscene.name);
                }
                SceneManager.LoadScene("juicing", LoadSceneMode.Additive);
                print("HEY THIS IS SHOULD BE A GROWING TREE");
            }
            if (currentOrange == northside)
            {
                GameObject   mainCamera = GameObject.Find("Main Camera");
                AnalogGlitch glitchy    = mainCamera.GetComponent <AnalogGlitch> ();
                glitchy.setGlitchboolean(true);

                for (int i = 1; i < SceneManager.sceneCount; i++)
                {
                    Scene currentscene = SceneManager.GetSceneAt(i);
                    Debug.Log("Current SCENE is '" + currentscene.name + "'.");
                    SceneManager.UnloadSceneAsync(currentscene.name);
                }
                SceneManager.LoadScene("GrowingTree", LoadSceneMode.Additive);

                print("ORANGE north");
            }
            if (currentOrange == eastside)
            {
                GameObject   mainCamera = GameObject.Find("Main Camera");
                AnalogGlitch glitchy    = mainCamera.GetComponent <AnalogGlitch> ();
                glitchy.setGlitchboolean(true);

                for (int i = 1; i < SceneManager.sceneCount; i++)
                {
                    Scene currentscene = SceneManager.GetSceneAt(i);
                    Debug.Log("Current SCENE is '" + currentscene.name + "'.");
                    SceneManager.UnloadSceneAsync(currentscene.name);
                }
                SceneManager.LoadScene("OrangeCutting", LoadSceneMode.Additive);
                print("ORANGE east");
            }
            if (currentOrange == westside)
            {
                GameObject   mainCamera = GameObject.Find("Main Camera");
                AnalogGlitch glitchy    = mainCamera.GetComponent <AnalogGlitch> ();
                glitchy.setGlitchboolean(true);

                for (int i = 1; i < SceneManager.sceneCount; i++)
                {
                    Scene currentscene = SceneManager.GetSceneAt(i);
                    Debug.Log("Current SCENE is '" + currentscene.name + "'.");
                    SceneManager.UnloadSceneAsync(currentscene.name);
                }
                SceneManager.LoadScene("RottingOrange", LoadSceneMode.Additive);
                print("ORANGE west");
            }
            lastOrange = currentOrange;
        }
    }
Пример #4
0
 // Constructor
 public Probes()
 {
     Yellow = new yellow();
     Pink = new pink();
     Orange = new orange();
     YellowOrange = new yellowOrange();
     YellowPink = new yellowPink();
 }