private void Prepare() { cameraWorldVector.x = Vector2.Distance( mainCamera.ScreenToWorldPoint(Vector3.zero), mainCamera.ScreenToWorldPoint(new Vector3(Screen.width, 0f))) * 0.5f; cameraWorldVector.y = Vector2.Distance( mainCamera.ScreenToWorldPoint(Vector3.zero), mainCamera.ScreenToWorldPoint(new Vector3(0f, Screen.height))) * 0.5f; Data = new WallData(cameraWorldVector, thickness, ceilingFactor); try { if (OnCreateEvent != null) { OnCreateEvent.Invoke(); } else { EventExtension.ThrowMessage(nameof(OnCreateEvent)); } } catch (Exception e) { EventExtension.PrintError(e); } }
/// <summary> /// Triggers the player input. /// </summary> public void TriggerPlayerInput() { try { if (OnPlayerInputEvent != null) { OnPlayerInputEvent.Invoke(); } else { EventExtension.ThrowMessage(nameof(OnPlayerInputEvent)); } } catch (Exception e) { EventExtension.PrintError(e); } }
public static void TriggerPreviousState() { try { if (OnPreviousState != null) { OnPreviousState.Invoke(); } else { EventExtension.ThrowMessage(nameof(OnPreviousState)); } } catch (Exception e) { EventExtension.PrintError(e); } }
/// <summary> /// Call this trigger from IState:OnExit(). /// </summary> /// <param name="state">Takes a state to run in StateMachine</param> /// <seealso cref="StateMachine"/> public static void TriggerNextState(IState state) { try { if (OnNextStateEvent != null) { OnNextStateEvent.Invoke(state); } else { EventExtension.ThrowMessage(nameof(OnNextStateEvent)); } } catch (Exception e) { EventExtension.PrintError(e); } }
public void OnEnter() { Debug.Log(GetType().Name + ".OnEnter"); try { if (OnEnterSpawnEvent != null) { OnEnterSpawnEvent.Invoke(); } else { EventExtension.ThrowMessage(nameof(OnEnterSpawnEvent)); } } catch (Exception e) { EventExtension.PrintError(e); } }
public void OnExit() { try { if (OnExitGameStateEvent != null) { OnExitGameStateEvent.Invoke(); } else { EventExtension.ThrowMessage(nameof(OnExitGameStateEvent)); } } catch (Exception e) { EventExtension.PrintError(e); } }