void OnTriggerEnter2D(Collider2D other) { if (other.tag.Equals(Constants.PLAYER_TAG)) { LevelEvent.EmitCheckpoint(level); } }
void Start() { LevelEvent.Listen(UpdateLevel); DeathEvent.ListenForGameManagerDeathEvent(Die); levelManager = GetComponent <LevelManager>(); RestartGame(); }
public static void TriggerEvent(string eventName) { LevelEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.Invoke(); } }
private void _restartLevel() { var levelEvent = new LevelEvent() { action = LevelActions.RESTART }; _eventSystem.Publish(levelEvent); }
private void _stopLevel() { var levelEvent = new LevelEvent() { action = LevelActions.STOP }; _eventSystem.Publish(levelEvent); _pool.RemoveAllEntities(); }
public void OnGameEvent(LevelEvent levelEvent) { if (levelEvent.IsEntered()) { StartCoroutine(FadeIn()); } else { StartCoroutine(FadeOut()); } }
private void _startLevel() { var levelEvent = new LevelEvent() { action = LevelActions.START }; Time.timeScale = 1; _createMap(); _playerController.start(); _eventSystem.Publish(levelEvent); }
/// <summary> /// Add and return an levelEvent with a title, a description and a date. /// </summary> /// <param name="title">Tittle for the levelEvent</param> /// <param name="description">Description for the levelEvent</param> /// <param name="dateTime">Date for the levelEvent</param> public void AddLevelEvent(string title, string description, DateTime dateTime) { if (levelEvents.Where(_levelEvent => _levelEvent.title == title).ToList().Count != 0) { Debug.LogErrorFormat("The event '{0}' is already in the agenda", title); return; } LevelEvent levelEvent = new LevelEvent(levelEvents.Count, title, description, dateTime); levelEvents.Add(levelEvent); OrderLevelEvents(); OnLevelEventAdded?.Invoke(levelEvents); }
public static void StopListening(string eventName, UnityAction listener) { if (levelEventHandler == null) { return; } LevelEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.RemoveListener(listener); } }
/// <summary> /// Cancel Level event /// </summary> /// <param name="e">The event to cancel</param> /// <param name="l">The level to cancel the event on</param> public static void CancelLevelEvent(LevelEvent e, Level l) { switch (e) { case LevelEvent.LevelUnload: l.cancelunload = true; break; case LevelEvent.LevelSave: l.cancelsave1 = true; break; } }
private void _pause(Boolean isPaused) { var levelEvent = new LevelEvent(); _pauseImage.enabled = isPaused; _playImage.enabled = !isPaused; _pauseTextGo.SetActive(!isPaused); _dashButtonGo.SetActive(isPaused); levelEvent.action = isPaused ? LevelActions.RESUME : LevelActions.PAUSE; _eventSystem.Publish(levelEvent); _showJoystick(isPaused); }
/// <summary> /// Cancel a World Event /// </summary> /// <param name="e">The event to cancel</param> /// <param name="w">The world</param> public static void CancelEvent(LevelEvent e, World w) { switch (e) { case LevelEvent.PhysicsUpdate: w.physics.cancelphysics = true; break; case LevelEvent.Save: World.cancelsave = true; break; case LevelEvent.ChunkGenerated: w.cancelchunk = true; break; } }
public static void Raise_Event(LevelEvent le) { switch (le) { case LevelEvent.LE_Check_Collision: { CurrentLevel.CheckLevelCollisions(null, null); } break; case LevelEvent.LE_PaintForm: { if (instance.MyForm != null) instance.MyForm.Invalidate(); } break; } }
public static void StartListening(string eventName, UnityAction listener) { LevelEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.AddListener(listener); } else { thisEvent = new LevelEvent(); thisEvent.AddListener(listener); instance.eventDictionary.Add(eventName, thisEvent); } }
/// <summary> /// Check to see if World Event is canceled /// </summary> /// <param name="e">The event to check</param> /// <param name="w">The world</param> /// <returns></returns> public static bool IsEventCancled(LevelEvent e, World w) { switch (e) { case LevelEvent.PhysicsUpdate: return(w.physics.cancelphysics); case LevelEvent.ChunkGenerated: return(w.cancelchunk); case LevelEvent.Save: return(World.cancelsave); default: return(false); } }
public static void Raise_Event(LevelEvent le) { switch (le) { case LevelEvent.LE_Check_Collision: { CurrentLevel.CheckLevelCollisions(null, null); } break; case LevelEvent.LE_PaintForm: { if (instance.MyForm != null) { instance.MyForm.Invalidate(); } } break; } }
public void OnGameEvent(LevelEvent levelEvent) { if (levelEvent.GetLevelIndex() == 0) { return; } if (levelEvent.IsEntered()) { m_Player = GameObject.FindGameObjectWithTag("Player"); m_PlayerStat = (PlayerStat)SaveManagerProxy.Get().GetSavedObject(typeof(PlayerStat), m_PlayerStatSavePath); m_PlayerHealth = m_Player.GetComponent <Health>(); m_PlayerHealth.SetMaxHealth(m_PlayerStat.m_HP); } else { SaveStat(); } }
public LevelEvent CreateFromJson(Level level) { LevelEvent levelEvent = new LevelEvent(); levelEvent.triggerEvent = new TriggerEvent() { trigger = level.GetTrigger(trigger), action = TriggerAction.On, }; levelEvent.activatorEvents = new List <ActivatorEvent>(); foreach (string activator in opens) { levelEvent.activatorEvents.Add(new ActivatorEvent() { activator = level.GetActivator(activator), action = ActivatorAction.On, }); } foreach (string activator in closes) { levelEvent.activatorEvents.Add(new ActivatorEvent() { activator = level.GetActivator(activator), action = ActivatorAction.Off, }); } foreach (string activator in toggles) { levelEvent.activatorEvents.Add(new ActivatorEvent() { activator = level.GetActivator(activator), action = ActivatorAction.Toggle, }); } return(levelEvent); }
/// <summary>Handles the message.</summary> /// <param name="message">The message.</param> public void Handle(LevelEvent message) { dispLevel = message.Get(); }
/// <summary> /// Check to see if World Event is canceled /// </summary> /// <param name="e">The event to check</param> /// <param name="w">The world</param> /// <returns></returns> public static bool IsEventCancled(LevelEvent e, World w) { switch (e) { case LevelEvent.PhysicsUpdate: return w.physics.cancelphysics; case LevelEvent.ChunkGenerated: return w.cancelchunk; case LevelEvent.Save: return World.cancelsave; default: return false; } }
/// <summary> /// Check to see if a level event is canceled /// </summary> /// <param name="e">The event you want to check</param> /// <param name="l">The level to check the event on</param> /// <returns></returns> public static bool IsLevelEventCancel(LevelEvent e, Level l) { switch (e) { case LevelEvent.LevelUnload: return l.cancelunload; case LevelEvent.LevelSave: return l.cancelsave1; default: return false; } }
public static void CancelEvent(LevelEvent e, World w) { }
public static bool IsEventCancled(LevelEvent e, World w) { return true; }
/// <summary> /// helper /// </summary> private void Invoke(LevelEvent e, LevelChangedEventArgs args) { if (e != null) e(args); }
void UpdateLevel(Hashtable h) { level = LevelEvent.ReadCheckpoint(h); Debug.Log("updated level to: " + level); }
// public float NewScale; public LevelEventPair(int beat, LevelEvent lEvent) { Beat = beat; Event = lEvent; // NewScale = scale; }