예제 #1
0
 void Start()
 {
     Play();
     blueObjects  = GameObject.FindGameObjectsWithTag("BlueObjects");
     redObjects   = GameObject.FindGameObjectsWithTag("RedObjects");
     greenObjects = GameObject.FindGameObjectsWithTag("GreenObjects");
     foreach (GameObject GreenObjects in greenObjects)
     {
         SpriteRenderer greenObjectsRenderer = GreenObjects.GetComponent <SpriteRenderer>();
         greenObjectsRenderer.enabled = false;
     }
     foreach (GameObject RedObjects in redObjects)
     {
         SpriteRenderer redObjectsRenderer = RedObjects.GetComponent <SpriteRenderer>();
         redObjectsRenderer.enabled = false;
     }
     foreach (GameObject BlueObjects in blueObjects)
     {
         SpriteRenderer blueObjectsRenderer = BlueObjects.GetComponent <SpriteRenderer>();
         blueObjectsRenderer.enabled = false;
     }
 }
예제 #2
0
    public void TriggerPill()
    {
        GameObject Doors;

        Doors = GameObject.FindGameObjectWithTag("MainCamera");
        Door tempDoor = Doors.GetComponent <Door>();

        GameObject[] Pills;
        if (count == 0)
        {
            GameObject[] redObjects;
            redObjects = GameObject.FindGameObjectsWithTag("RedObjects");
            foreach (GameObject RedObjects in redObjects)
            {
                SpriteRenderer redObjectsRenderer = RedObjects.GetComponent <SpriteRenderer>();
                redObjectsRenderer.enabled = true;
            }
            count++;
        }
        else if (count == 1 && tempDoor.CurrentRoom == 3)
        {
            GameObject[] BluePills;
            BluePills = GameObject.FindGameObjectsWithTag("BluePill");
            foreach (GameObject BluePillObjs in BluePills)
            {
                SpriteRenderer BluePillRenderer = BluePillObjs.GetComponent <SpriteRenderer>();
                BluePillRenderer.enabled = false;
            }
            GameObject[] BluePills2;
            BluePills2 = GameObject.FindGameObjectsWithTag("BluePill2");
            foreach (GameObject BluePill2Objs in BluePills2)
            {
                SpriteRenderer BluePill2Renderer = BluePill2Objs.GetComponent <SpriteRenderer>();
                BluePill2Renderer.enabled = false;
            }
            GameObject[] blueObjects;
            blueObjects = GameObject.FindGameObjectsWithTag("BlueObjects");
            foreach (GameObject BlueObjects in blueObjects)
            {
                SpriteRenderer blueObjectsRenderer = BlueObjects.GetComponent <SpriteRenderer>();
                blueObjectsRenderer.enabled = true;
            }
            count++;
        }
        else if (count == 2 && tempDoor.CurrentRoom == 2)
        {
            GameObject[] GreenPills;
            GreenPills = GameObject.FindGameObjectsWithTag("GreenPill");
            foreach (GameObject GreenPillObjs in GreenPills)
            {
                SpriteRenderer GreenPillRenderer = GreenPillObjs.GetComponent <SpriteRenderer>();
                GreenPillRenderer.enabled = false;
            }
            GameObject[] greenObjects;
            greenObjects = GameObject.FindGameObjectsWithTag("GreenObjects");
            foreach (GameObject GreenObjects in greenObjects)
            {
                SpriteRenderer greenObjectsRenderer = GreenObjects.GetComponent <SpriteRenderer>();
                greenObjectsRenderer.enabled = true;
            }
            count++;
        }
        Pills = GameObject.FindGameObjectsWithTag("Pill");
        foreach (GameObject PillInstance in Pills)
        {
            SpriteRenderer PillRenderer = PillInstance.GetComponent <SpriteRenderer>();
            PillRenderer.enabled = false;
        }
        GameObject[] Circuits;
        Circuits = GameObject.FindGameObjectsWithTag("Circuit");
        foreach (GameObject CircuitObj in Circuits)
        {
            Circuit tempCircuit = CircuitObj.GetComponent <Circuit>();
            if (tempCircuit.isComplete == false)
            {
                tempCircuit.isEnabled = true;
            }
        }
    }