private void OnSwitchedMode(LevelControl.Modes m) { if (m == LevelControl.Modes.Play) { editModeUIParent.SetActive(false); playerPosEditMode = new Vector3( playerTransform.position.x, playerTransform.position.y, Camera.main.transform.position.z); // CommonPlayMode handles the camera in this case } else if (m == LevelControl.Modes.Edit) // not the most performant, but will do for now { // reset this, just in case. Debug, basically inhibitingCount = 0; editModeUIParent.SetActive(true); // not the most performant, but will do for now CurrentAction = EditingActions.None; OnSwitchedEditingActionTo?.Invoke(EditingActions.None); cinemachineBrain.enabled = false; Camera.main.transform.position = playerPosEditMode; } }
public void SwitchToAction(EditingActions a) { if (a != CurrentAction) // ony do stuff if we didn't change to the same action { CurrentAction = a; OnSwitchedEditingActionTo?.Invoke(CurrentAction); Debug.Log($"switched to action {a.ToString()}"); } }