public static bool AllowedToDoRotation = true; // for when you're placing wires public static void RunGameplayRotation() { if (!AllowedToDoRotation) { return; } if (StuffPlacer.OkayToPlace) { return; } if (Input.GetButtonDown("Rotate")) { RaycastHit hit; if (Physics.Raycast(FirstPersonInteraction.Ray(), out hit, Settings.ReachDistance, FirstPersonInteraction.IgnorePlayerLayermask)) { RotateThing(hit.collider.gameObject); } else { SoundPlayer.PlaySoundGlobal(Sounds.FailDoSomething); } } // kind of awkward that both this class and StuffPlacer are f*****g with RotationLocked. TODO do it better if (Input.GetButtonDown("RotationLock")) { RaycastHit hit; if (Physics.Raycast(FirstPersonInteraction.Ray(), out hit, Settings.ReachDistance, Wire.IgnoreWiresLayermask)) { if (StuffPlacer.GetThingBeingPlaced == null || !StuffPlacer.OkayToPlace) // so that if there's something we're placing we can lock rotation to that and not what's under it { if (hit.collider.tag == "World" || hit.collider.tag == "CircuitBoard") { SetRotationLockToFalseIfThingBeingPlacedIsNull(); return; } StuffPlacer.SetRotationLockAngles(ComponentPlacer.FullComponent(hit.collider)); StuffPlacer.RotationLocked = true; } } else { StuffPlacer.RotationLocked = false; } SelectionMenu.Instance.SetRotationLockText(); } if (Input.GetButtonDown("RotateThroughBoard")) { RotateThroughBoard(); } }