示例#1
0
    void Start()
    {
        OxygenController = GameObject.Find("OxygenDisplays").GetComponent <OxygenControl>();

        //buttons

        GreenButton   = GameObject.Find("BONSAI_ROOM/OxygenPanel/OxygenGreenButton").GetComponentInChildren <VRTK_PhysicsPusher>();
        MagentaButton = GameObject.Find("BONSAI_ROOM/OxygenPanel/OxygenMagentaButton").GetComponentInChildren <VRTK_PhysicsPusher>();
        CyanButton    = GameObject.Find("BONSAI_ROOM/OxygenPanel/OxygenCyanButton").GetComponentInChildren <VRTK_PhysicsPusher>();
        YellowButton  = GameObject.Find("BONSAI_ROOM/OxygenPanel/OxygenYellowButton").GetComponentInChildren <VRTK_PhysicsPusher>();
        RedButton     = GameObject.Find("BONSAI_ROOM/OxygenPanel/OxygenRedButton").GetComponentInChildren <VRTK_PhysicsPusher>();
        BlueButton    = GameObject.Find("BONSAI_ROOM/OxygenPanel/OxygenBlueButton").GetComponentInChildren <VRTK_PhysicsPusher>();

        ClockWiseButton        = GameObject.Find("BONSAI_ROOM/OxygenPanel/OxygenClockWiseButton").GetComponentInChildren <VRTK_PhysicsPusher>();
        CounterClockWiseButton = GameObject.Find("BONSAI_ROOM/OxygenPanel/OxygenCounterClockWiseButton").GetComponentInChildren <VRTK_PhysicsPusher>();

        LampColours = new Color[4];

        //initial oxygen state here
        LampColours[0] = Color.yellow;
        LampColours[1] = Color.red;
        LampColours[2] = Color.green;
        LampColours[3] = Color.blue;

        currentlySelectedLamp = 1;

        //oxygen lamps and colours

        FirstLamp  = GameObject.Find("BONSAI_ROOM/BonsaiLamps/FirstLamp").GetComponent <Light>();
        SecondLamp = GameObject.Find("BONSAI_ROOM/BonsaiLamps/SecondLamp").GetComponent <Light>();
        ThirdLamp  = GameObject.Find("BONSAI_ROOM/BonsaiLamps/ThirdLamp").GetComponent <Light>();
        FourthLamp = GameObject.Find("BONSAI_ROOM/BonsaiLamps/FourthLamp").GetComponent <Light>();


        // shows on the panel on the side which lamp is selected currently

        SelectedLampIndicator = GameObject.Find("BONSAI_ROOM/OxygenPanel/SelectedLampIndicators").GetComponent <Animator>();

        FirstLampBeam  = GameObject.Find("BONSAI_ROOM/OxygenPanel/SelectedLampIndicators/FirstLampBeam").GetComponent <MeshRenderer>().material;
        SecondLampBeam = GameObject.Find("BONSAI_ROOM/OxygenPanel/SelectedLampIndicators/SecondLampBeam").GetComponent <MeshRenderer>().material;
        ThirdLampBeam  = GameObject.Find("BONSAI_ROOM/OxygenPanel/SelectedLampIndicators/ThirdLampBeam").GetComponent <MeshRenderer>().material;
        FourthLampBeam = GameObject.Find("BONSAI_ROOM/OxygenPanel/SelectedLampIndicators/FourthLampBeam").GetComponent <MeshRenderer>().material;

        LampGreen   = GameObject.Find("BONSAI_ROOM/LampColours/LampGreen").GetComponent <MeshRenderer>().material.color;
        LampMagenta = GameObject.Find("BONSAI_ROOM/LampColours/LampMagenta").GetComponent <MeshRenderer>().material.color;
        LampCyan    = GameObject.Find("BONSAI_ROOM/LampColours/LampCyan").GetComponent <MeshRenderer>().material.color;
        LampYellow  = GameObject.Find("BONSAI_ROOM/LampColours/LampYellow").GetComponent <MeshRenderer>().material.color;
        LampRed     = GameObject.Find("BONSAI_ROOM/LampColours/LampRed").GetComponent <MeshRenderer>().material.color;
        LampBlue    = GameObject.Find("BONSAI_ROOM/LampColours/LampBlue").GetComponent <MeshRenderer>().material.color;

        //initialize lamp beams here
        FirstLampBeam.color  = LampYellow;
        SecondLampBeam.color = LampRed;
        ThirdLampBeam.color  = LampGreen;
        FourthLampBeam.color = LampMagenta;

        //booleans

        lampJustChanged = false;
    }
 // Adds given oxygen controller as invoker of update O2 event
 public static void AddUpdateO2Invoker(OxygenControl invoker)
 {
     // adds invoker to list and adds all listeners to this invoker
     updateO2Invokers.Add(invoker);
     foreach (UnityAction <float> listener in updateO2Listeners)
     {
         invoker.AddUpdateO2Listener(listener);
     }
 }
示例#3
0
        //-----------------------------------------------------

        public Program()
        {
            //Initialize logic for state maschine ------------------------------------
            lcdHandler     = new LCDClass(this);
            stateHandler   = new StateMaschine(lcdHandler, this);
            oxygenHandler  = new OxygenControl(lcdHandler, this);
            gravityHandler = new GravityControl(lcdHandler, this);
            //---------------------------------------------------------------------------

            StateMaschienOperational  = stateHandler.isOperational();
            OxygenControlOperational  = oxygenHandler.isOperational();
            GravityControlOperational = gravityHandler.isOperational();
            //Getting all GG at once to check if they are there--------------------------
        }
示例#4
0
 /// <summary>
 /// Used for initialization
 /// </summary>
 void Awake()
 {
     // retrieve necessary components
     myOxygenControl = GetComponent <OxygenControl>();
 }