예제 #1
0
파일: PickUp.cs 프로젝트: Natorkawl/shima
    void OnGUI()
    {
        if (walkedOverObject != null)
        {
            switch (walkedOverObject.tag)
            {
            case "PickUp":
            {
                if (isPick == false && guiShow == true)
                {
                    GUI.Box(new Rect(Screen.width / 2, Screen.height / 2, 100, 25), "Pick up object");
                }

                break;
            }

            case "Door":
            {
                if (doorInteraction.GetStatus() == false && guiShow == true)
                {
                    GUI.Box(new Rect(Screen.width / 2, Screen.height / 2, 100, 25), "Open Door");
                }


                if (doorInteraction.GetStatus() == true && guiShow == true)
                {
                    GUI.Box(new Rect(Screen.width / 2, Screen.height / 2, 100, 25), "Close Door");
                }


                break;
            }

            case "Light":
            {
                if (walkedOverObject.transform.GetChild(0).GetComponent <Light>().enabled == false && guiShow == true)
                {
                    GUI.Box(new Rect(Screen.width / 2, Screen.height / 2, 100, 25), "Open Light");
                }


                if (walkedOverObject.transform.GetChild(0).GetComponent <Light>().enabled&& guiShow == true)
                {
                    GUI.Box(new Rect(Screen.width / 2, Screen.height / 2, 100, 25), "Close Light");
                }

                break;
            }

            case "Electronic":
            {
                if (walkedOverObject.GetComponent <ElectronicDevice>().DeviceState == ElectronicDevice.State.Off)
                {
                    GUI.Box(new Rect(Screen.width / 2, Screen.height / 2, 100, 25), "Open Device");
                }

                if (walkedOverObject.GetComponent <ElectronicDevice>().DeviceState == ElectronicDevice.State.On)
                {
                    GUI.Box(new Rect(Screen.width / 2, Screen.height / 2, 100, 25), "Close Device");
                }

                break;
            }

            case "Drawer":
            {
                if (drawerInteraction.GetStatus(walkedOverObject.name) == false && guiShow == true)
                {
                    GUI.Box(new Rect(Screen.width / 2, Screen.height / 2, 100, 25), "Open Drawer");
                }

                if (drawerInteraction.GetStatus(walkedOverObject.name) == true && guiShow == true)
                {
                    GUI.Box(new Rect(Screen.width / 2, Screen.height / 2, 100, 25), "Close Drawer");
                }

                break;
            }

            case "Test-RFID":
            {
                GUI.Box(new Rect(Screen.width / 2, Screen.height / 2, 100, 25), "Move Object");
                break;
            }


            default:
                break;
            }
        }
    }