public Dictionary <string, LevelEvents[]> GetEvents() { var dict = new Dictionary <string, LevelEvents[]>(); var e = new LevelEvents(); e.LevelNumber = 1; e.Star1 = new LevelEvents.EventTrigger[] { new LevelEvents.EventTrigger() { Trigger = "Turns", TriggerOn = "1-2", Events = new LevelEvents.Event[] { new LevelEvents.Event() { EventType = "Destroy", NumberOfPiecesToSelect = 2 } } }, new LevelEvents.EventTrigger() { Trigger = "Turns", TriggerOn = "3-4", Events = new LevelEvents.Event[] { new LevelEvents.Event() { EventType = "Destroy", NumberOfPiecesToSelect = 2 } } } }; e.Star2 = new LevelEvents.EventTrigger[] { new LevelEvents.EventTrigger() { Trigger = "Turns", TriggerOn = "2-5", Events = new LevelEvents.Event[] { new LevelEvents.Event() { EventType = "Change", TypeOfPieceToSelect = "l" } } }, new LevelEvents.EventTrigger() { Trigger = "Turns", TriggerOn = "5-7", Events = new LevelEvents.Event[] { new LevelEvents.Event() { EventType = "Destroy", NumberOfPiecesToSelect = 4 } } } }; e.Star2 = new LevelEvents.EventTrigger[] { new LevelEvents.EventTrigger() { Trigger = "Turns", TriggerOn = "2-5", Events = new LevelEvents.Event[] { new LevelEvents.Event() { EventType = "Add", PositionsSelected = new string[] { "3:2", "2:4", "3:3" }, NewPieceType = "x" }, new LevelEvents.Event() { EventType = "ChangeS", TypeOfPieceToSelect = "x", NewPieceType = "2" } } } }; dict.Add("Golem", new LevelEvents[] { e }); return(dict); }
/// <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(LevelEvents e, Level l) { switch (e) { case LevelEvents.LevelUnload: break; } }
// Use this for initialization void Awake() { if (Singleton == null) { Singleton = this; } nextFightZone = transform.parent.transform.GetChild(cameraEvent + 1); }
/// <summary> Cancel Level event </summary> public static void CancelLevelEvent(LevelEvents e, Level l) { switch (e) { case LevelEvents.LevelUnload: l.cancelunload = true; break; case LevelEvents.LevelSave: l.cancelsave1 = true; break; } }
/// <summary> Check to see if a level event is canceled </summary> public static bool IsLevelEventCancel(LevelEvents e, Level l) { switch (e) { case LevelEvents.LevelUnload: return(l.cancelunload); case LevelEvents.LevelSave: return(l.cancelsave1); } return(false); }
private void PrepareNewGame() { ChangeToPullArrowPhase(); roundNumber = 1; for (int i = 0; i < roundScore.Length; i++) { roundScore[i] = 0; } LevelEvents.RaiseLevelEvent(LevelEvents.LevelEventType.ContinueToNextLevel); }
private void Awake() { instance = this; playerEvents = new PlayerEvents(); evilPlayerEvents = new EvilPlayerEvents(); enemyEvents = new EnemyEvents(); levelEvents = new LevelEvents(); enviromentEvents = new EnviromentEvents(); weaponEvents = new WeaponEvents(); itemEvents = new ItemEvents(); }
private void SpawnObject() { if (currentObjectInstance != null) { Destroy(currentObjectInstance); } RaycastHit hitInfo = GetRandomSpawnHitRayPosition(); currentObjectInstance = Instantiate(spawnObject, hitInfo.point, Quaternion.identity); currentObjectInstance.transform.LookAt(GameObject.FindGameObjectWithTag("Player").transform); SpawnTargetDistanceOverlayUI(); LevelEvents.RaiseLevelEvent(LevelEvents.LevelEventType.SpawnTarget); }
// Use this for initialization void Start() { // Register listeners PlayerEvents.Instance().DespawnPlayer += SpawnPlayer; LevelEvents.Instance().SetCheckpoint += SetCheckpoint; LevelEvents.Instance().ReachGoal += WinLevel; // Level Manager logic currentCheckpoint = startPoint; player = Instantiate(PlayerPrefab); SpawnPlayer(); }
/// <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(LevelEvents e, Level l) { switch (e) { case LevelEvents.LevelUnload: l.cancelunload = true; break; case LevelEvents.LevelSave: l.cancelsave1 = true; break; } }
private void OnTriggerEnter2D(Collider2D collision) { if (isTriggered) { return; } if (collision.gameObject.tag == "Player") { LevelEvents.Instance().InvokeSetCheckpoint(transform); isTriggered = true; animator.SetTrigger("Triggered"); } }
IEnumerator WaitForSecondsContinueToNextLevelEnumerator() { yield return(new WaitForSeconds(secondsBeforeContinueToNextLevel)); roundNumber += 1; // go to next round if (roundNumber > 10) { LevelEvents.RaiseLevelEvent(LevelEvents.LevelEventType.GameOver); } else { ChangeToPullArrowPhase(); LevelEvents.RaiseLevelEvent(LevelEvents.LevelEventType.ContinueToNextLevel); } }
/// <summary> /// Clears the agenda and adds the level events on the given ScriptableObject. /// </summary> /// <param name="_levelEventsSO">ScriptableObject containing the level events of the level</param> public void LoadEvents(LevelEvents _levelEventsSO) { ClearAgenda(); for (int i = 0; i < _levelEventsSO.levelEvents.Count; i++) { AddLevelEvent( _levelEventsSO.levelEvents[i].title, _levelEventsSO.levelEvents[i].description, new System.DateTime( _levelEventsSO.levelEvents[i].year, _levelEventsSO.levelEvents[i].month, _levelEventsSO.levelEvents[i].day, _levelEventsSO.levelEvents[i].hour, _levelEventsSO.levelEvents[i].minute, 0) ); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); levelEvents = (LevelEvents)target; EditorGUILayout.Space(); EditorGUILayout.Space(); showAddView = EditorGUILayout.Foldout(showAddView, "Add new level event:"); if (showAddView) { AddNewLevelEvent(); } EditorGUILayout.Space(); EditorGUILayout.Space(); showRemoveView = EditorGUILayout.Foldout(showRemoveView, "Remove a level event:"); if (showRemoveView) { RemoveLevelEvent(); } }
internal GameEvents() { Level = new LevelEvents(); }
private void Construct(LevelEvents levelEvents) { _levelEvents = levelEvents; }
private void Awake() { events = GameObject.Find("Level Events").GetComponent <LevelEvents>(); }
private void Awake() { Current = this; }
public void AddScore(int addScore) { roundScore[roundNumber - 1] = addScore; LevelEvents.RaiseLevelEvent(LevelEvents.LevelEventType.AddScore); }
/// <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(LevelEvents e, Level l) { switch (e) { case LevelEvents.LevelUnload: return l.cancelunload; case LevelEvents.LevelSave: return l.cancelsave1; default: return false; } }
public void SimpleEvent_ToJSON_FromJSON() { var levelEvents = new LevelEvents[1]; var e = new LevelEvents(); e.LevelNumber = 1; e.Star1 = new LevelEvents.EventTrigger[] { new LevelEvents.EventTrigger() { Trigger = "Turns", TriggerOn = "1-2", Events = new LevelEvents.Event[] { new LevelEvents.Event() { EventType = "Destroy", NumberOfPiecesToSelect = 2 } } }, new LevelEvents.EventTrigger() { Trigger = "Turns", TriggerOn = "3-4", Events = new LevelEvents.Event[] { new LevelEvents.Event() { EventType = "Destroy", NumberOfPiecesToSelect = 2 } } } }; e.Star2 = new LevelEvents.EventTrigger[] { new LevelEvents.EventTrigger() { Trigger = "Turns", TriggerOn = "2-5", Events = new LevelEvents.Event[] { new LevelEvents.Event() { EventType = "Change", TypeOfPieceToSelect = "l" } } }, new LevelEvents.EventTrigger() { Trigger = "Turns", TriggerOn = "5-7", Events = new LevelEvents.Event[] { new LevelEvents.Event() { EventType = "Destroy", NumberOfPiecesToSelect = 4 } } } }; e.Star2 = new LevelEvents.EventTrigger[] { new LevelEvents.EventTrigger() { Trigger = "Turns", TriggerOn = "2-5", Events = new LevelEvents.Event[] { new LevelEvents.Event() { EventType = "Add", PositionsSelected = new string[] { "3:2", "2:4", "3:3" }, NewPieceType = "x" }, new LevelEvents.Event() { EventType = "ChangeS", TypeOfPieceToSelect = "x", NewPieceType = "2" } } } }; levelEvents[0] = e; var jsonFormat = JsonHelper.ToJson(levelEvents); Debug.Log(jsonFormat); Assert.IsFalse(string.IsNullOrWhiteSpace(jsonFormat)); var decodedJson = JsonHelper.FromJson <LevelEvents>(jsonFormat); Assert.IsNotNull(decodedJson); Assert.AreEqual(1, decodedJson.Length); Assert.AreEqual(1, decodedJson[0].LevelNumber); Assert.IsNotNull(decodedJson[0].Star1); Assert.IsNotNull(decodedJson[0].Star2); Assert.IsNotNull(decodedJson[0].Star3); }
public void RetryGame() { ClearPrefabScoreList(); gameOverScreen.SetActive(false); LevelEvents.RaiseLevelEvent(LevelEvents.LevelEventType.RetryGame); }
private void Awake() { instance = this; }