コード例 #1
0
ファイル: LeverAnimate.cs プロジェクト: timkoff/SGICollab
    void Start()
    {
        DoorTriggerScript dtsRef = transform.GetComponent <DoorTriggerScript>();

        if (dtsRef.triggerMode == DoorTriggerScript.TriggerMode.Hold_To_Open)
        {
            shouldHold = true;
        }
    }
コード例 #2
0
    int SwitchCamera(int i)
    {
        (cameras[currCameraIndex].GetComponent <Camera>() as Camera).enabled = false;
        currCameraIndex = i - 1;

        if (currCameraIndex >= cameras.Length || currCameraIndex < 0)
        {
            currCameraIndex = 0;
        }

        //print("currCameraIndex = " + currCameraIndex);
        Debug.Log("Length of array is" + cameras.Length);
        Debug.Log("current index is" + currCameraIndex);
        if (currCameraIndex > 0)
        {
            GameObject buttonsForDoors = GameObject.FindGameObjectWithTag("SwitchForDoor");
            if (buttonsForDoors)
            {
                DoorTriggerScript thisScript = buttonsForDoors.GetComponent <DoorTriggerScript>();

                thisScript.showColours();
            }
            GameObject buttonsForLifts = GameObject.FindGameObjectWithTag("SwitchForLift");
            if (buttonsForLifts)
            {
                triggerCsScript thatScript = buttonsForLifts.GetComponent <triggerCsScript>();

                thatScript.showColours();
            }
        }
        else
        {
            GameObject buttonsForDoors = GameObject.FindGameObjectWithTag("SwitchForDoor");
            if (buttonsForDoors)
            {
                DoorTriggerScript thisScript = buttonsForDoors.GetComponent <DoorTriggerScript>();
                thisScript.hideColours();
            }
            GameObject buttonsForLifts = GameObject.FindGameObjectWithTag("SwitchForLift");
            if (buttonsForLifts)
            {
                triggerCsScript thatScript = buttonsForLifts.GetComponent <triggerCsScript>();
                thatScript.hideColours();
            }
        }
        (cameras[currCameraIndex].GetComponent <Camera>() as Camera).enabled = true;

        return(currCameraIndex);
    }