예제 #1
0
        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);
        }
예제 #2
0
 /// <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;
     }
 }
예제 #3
0
    // Use this for initialization
    void Awake()
    {
        if (Singleton == null)
        {
            Singleton = this;
        }

        nextFightZone = transform.parent.transform.GetChild(cameraEvent + 1);
    }
예제 #4
0
        /// <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;
            }
        }
예제 #5
0
        /// <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);
        }
예제 #6
0
 private void PrepareNewGame()
 {
     ChangeToPullArrowPhase();
     roundNumber = 1;
     for (int i = 0; i < roundScore.Length; i++)
     {
         roundScore[i] = 0;
     }
     LevelEvents.RaiseLevelEvent(LevelEvents.LevelEventType.ContinueToNextLevel);
 }
예제 #7
0
 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();
 }
예제 #8
0
    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);
    }
예제 #9
0
    // 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();
    }
예제 #10
0
        /// <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;

            }
        }
예제 #11
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (isTriggered)
        {
            return;
        }

        if (collision.gameObject.tag == "Player")
        {
            LevelEvents.Instance().InvokeSetCheckpoint(transform);
            isTriggered = true;
            animator.SetTrigger("Triggered");
        }
    }
예제 #12
0
    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);
        }
    }
예제 #13
0
 /// <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)
             );
     }
 }
예제 #14
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();
        }
    }
예제 #15
0
 internal GameEvents()
 {
     Level = new LevelEvents();
 }
예제 #16
0
 private void Construct(LevelEvents levelEvents)
 {
     _levelEvents = levelEvents;
 }
예제 #17
0
 private void Awake()
 {
     events = GameObject.Find("Level Events").GetComponent <LevelEvents>();
 }
예제 #18
0
 private void Awake()
 {
     Current = this;
 }
예제 #19
0
 public void AddScore(int addScore)
 {
     roundScore[roundNumber - 1] = addScore;
     LevelEvents.RaiseLevelEvent(LevelEvents.LevelEventType.AddScore);
 }
예제 #20
0
        /// <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;

            }
        }
예제 #21
0
        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);
        }
예제 #22
0
 public void RetryGame()
 {
     ClearPrefabScoreList();
     gameOverScreen.SetActive(false);
     LevelEvents.RaiseLevelEvent(LevelEvents.LevelEventType.RetryGame);
 }
예제 #23
0
 private void Awake()
 {
     instance = this;
 }