void Start() { playerState = EPlayerStates.Teleport; itemSpawner = GetComponent <ItemSpawner>(); itemSelection = GetComponent <ItemSelection> (); itemSelection2 = GetComponent <ItemSelection2> (); copyPaste = GetComponent <CopyPaste>(); measureTool = GetComponent <MeasureTool>(); itemSpawner.enabled = false; }
//============================PLAYER STATE================================================// public void ToggleState() { if (m_PlayerState == EPlayerStates.ONBAMBU) { m_PlayerState = EPlayerStates.ONAIR; m_Rigidbody.gravityScale = 1; } else { m_PlayerState = EPlayerStates.ONBAMBU; m_Rigidbody.gravityScale = 0; } }
public PlayerMovement() { m_PlayerPosition = new PipeOneLeft(this); m_PlayerState = EPlayerStates.ONBAMBU; }
// Update is called once per frame void Update() { // tap Y to toggle between selection mode and teleport mode if (OVRInput.GetDown(OVRInput.RawButton.Y)) { playerState = (EPlayerStates)(((int)(((int)playerState) + 1)) % ((int)EPlayerStates.SIZE)); } else if (OVRInput.GetDown(OVRInput.RawButton.X)) { playerState = (EPlayerStates)(((int)(((int)playerState) - 1) + (int)EPlayerStates.SIZE) % ((int)EPlayerStates.SIZE)); } switch (playerState) { case EPlayerStates.Teleport: teleportRef.enabled = true; itemSpawner.enabled = false; itemSelection.enabled = false; itemSelection2.enabled = false; copyPaste.enabled = false; measureTool.enabled = false; SetStateText("Teleport Mode"); SetInstructionText("Press hold Right Palm\nAim with Right Touch Controller\nPull right trigger to teleport"); DeselectObjects(); break; case EPlayerStates.Spawn: teleportRef.enabled = false; itemSpawner.enabled = true; itemSelection.enabled = false; itemSelection2.enabled = false; copyPaste.enabled = false; measureTool.enabled = false; SetStateText("Spawn Mode"); SetInstructionText("Cycle through objects to spawn with A and B\nAim with Right Touch Controller\nPull right trigger to spawn that object"); DeselectObjects(); break; case EPlayerStates.Select1: teleportRef.enabled = false; itemSpawner.enabled = false; itemSelection.enabled = true; itemSelection2.enabled = false; copyPaste.enabled = false; measureTool.enabled = false; SetStateText("Select1 Mode"); SetInstructionText("Press and hold Right Palm\n" + "Aim with Right Touch Controller\n" + "Pull right trigger to select object(s)\n " + "Use right thumbstick to translate, left thumbstick to rotate\n" + "Press A to Snap in place"); break; case EPlayerStates.Select2: teleportRef.enabled = false; itemSpawner.enabled = false; itemSelection.enabled = false; itemSelection2.enabled = true; copyPaste.enabled = false; measureTool.enabled = false; SetStateText("Select2 Mode"); SetInstructionText("Touch the object by pressing Right Palm once\n" + "Translate/Rotate the object by holding trigger and moving the Right Controller\n" + "Press A to Snap in place"); break; case EPlayerStates.CopyPaste: teleportRef.enabled = false; itemSpawner.enabled = false; itemSelection.enabled = false; itemSelection2.enabled = false; copyPaste.enabled = true; measureTool.enabled = false; SetStateText("CopyPaste Mode"); SetInstructionText("Press and hold Right Palm\nAim with Right Touch Controller\n" + "Pull right trigger to copy object(s)\nUse right thumbstick to translate, left thumbstick to rotate\n" + "Press A to Snap in place"); DeselectObjects(); break; case EPlayerStates.MeasuringTool: teleportRef.enabled = false; itemSpawner.enabled = false; itemSelection.enabled = false; itemSelection2.enabled = false; copyPaste.enabled = false; measureTool.enabled = true; SetStateText("Measuring Mode"); SetInstructionText("Press and hold Right Palm and Left Palm\nAim with Left and Right Touch Controller\n" + "Pull Right and Left triggers to set points\nPress B to reset points\n"); DeselectObjects(); break; default: teleportRef.enabled = true; itemSpawner.enabled = false; itemSelection.enabled = false; itemSelection2.enabled = false; copyPaste.enabled = false; measureTool.enabled = false; SetStateText("Teleport Mode"); SetInstructionText("Press hold Right Palm\nAim with Right Touch Controller\nPull right trigger to teleport"); DeselectObjects(); break; } }