Ejemplo n.º 1
0
    private void HandleGameEvent(EventManager.GameEvent gameEvent)
    {
        if (TutorialMessages.Any(m => m.EventTrigger == gameEvent))
        {
            var m = TutorialMessages.First(mes => mes.EventTrigger == gameEvent);

            if (Holder.activeInHierarchy)
            {
                MessageQueue.Enqueue(m);
            }
            else
            {
                StartCoroutine(DisplayMessageRoutine(m));
            }
        } //slight hack to control that clickable advice stays and closes when the dilemma screen does
        else if (gameEvent == EventManager.GameEvent.CloseDilemma)
        {
            if (CurrentEvent == EventManager.GameEvent.GuidingCharacterHelp)
            {
                if (MessageQueue.Any())
                {
                    StartCoroutine(DisplayMessageRoutine(MessageQueue.Dequeue()));
                }
                else
                {
                    Close();
                }
            }

            if (MessageQueue.Any(e => e.EventTrigger == EventManager.GameEvent.GuidingCharacterHelp))
            {
                MessageQueue = new Queue <TutorialMessage>(MessageQueue.Where(e => e.EventTrigger != EventManager.GameEvent.GuidingCharacterHelp));
            }
        }
    }
Ejemplo n.º 2
0
 private void OnGameEvent(EventManager.GameEvent obj)
 {
     if (obj.myType == EventManager.GameEvent.EventType.PlayAgain)
     {
         ResetScores();
     }
 }
Ejemplo n.º 3
0
    private void OnGameEvent(EventManager.GameEvent obj)
    {
        switch (obj.myType)
        {
        case EventManager.GameEvent.EventType.NextLevel:
        case EventManager.GameEvent.EventType.StartGame:
        {
            CurrentLevelIndex = obj.myLevelData.LevelIndex;
            myLevelState      = GameState.Playing;
            Goal      = obj.myLevelData.Goal;
            MovesLeft = obj.myLevelData.Moves;
            InitializeGameSettings();
            Settings.Reset();
            break;
        }

        case EventManager.GameEvent.EventType.LevelComplete:
        {
            Levels.Levels[CurrentLevelIndex].IsComplete = true;
            break;
        }

        case EventManager.GameEvent.EventType.NewWave:
        {
            Settings.Reset();
            myWaveState = GameState.Playing;
            break;
        }

        case EventManager.GameEvent.EventType.PreScore:
            myWaveState = GameState.Won;
            break;
        }
    }
Ejemplo n.º 4
0
    private void onGameEvent(EventManager.GameEvent obj)
    {
        //if(obj.myType == EventManager.GameEvent.EventType.Win)
        //{
        //MoveToCenter();
        //}
        if (obj.myType == EventManager.GameEvent.EventType.PauseGame)
        {
            pauseVelocity = rb.velocity;
            rb.bodyType   = RigidbodyType2D.Static;
        }
        else if (obj.myType == EventManager.GameEvent.EventType.ResumeGame)
        {
            rb.bodyType = RigidbodyType2D.Dynamic;
            Debug.Log("Shape.onGameEvent: Changing " + gameObject.name + "to dynamic");

            rb.velocity = pauseVelocity;
        }
        else if (obj.myType == EventManager.GameEvent.EventType.NewWave)
        {
            if (collectable == null)
            {
                GameObject ob = GameObject.FindGameObjectWithTag("Collectables");
                collectable = ob.GetComponent <RectTransform>();
            }
        }
    }
Ejemplo n.º 5
0
 private void OnGameEvent(EventManager.GameEvent obj)
 {
     if (obj.myType == EventManager.GameEvent.EventType.LifeLost)
     {
         if (targetLife == null)
         {
             return;
         }
         var life = targetLife.gameObject.GetComponent <Life>();
         if (life == null)
         {
             targetLife = null;
             return;
         }
         if (LifeManager.lives.Contains(life) == false)
         {
             if (LifeManager.lives.Count > 0)
             {
                 UpdateTarget();
             }
             else
             {
                 targetLife = null;
             }
         }
     }
 }
Ejemplo n.º 6
0
    private void OnGameEvent(EventManager.GameEvent obj)
    {
        if (GameManager.GetCurrentLevelType() == LevelType.ConnectAllTimed)
        {
            switch (obj.myType)
            {
            case EventManager.GameEvent.EventType.StartGame:
                shouldCount = true;
                break;

            case EventManager.GameEvent.EventType.PauseGame:
                shouldCount = false;
                break;

            case EventManager.GameEvent.EventType.ResumeGame:
                shouldCount = true;
                break;

            case EventManager.GameEvent.EventType.GameOver:
                shouldCount = false;
                break;

            case EventManager.GameEvent.EventType.LevelComplete:
                shouldCount = false;
                break;

            default:
                break;
            }
        }
    }
Ejemplo n.º 7
0
    private void OnGameState(EventManager.GameEvent obj)
    {
        switch (obj.myType)
        {
        case EventManager.GameEvent.EventType.NewWave:
            break;

        //case EventManager.GameEvent.EventType.Win:
        //    {
        //        //StartCoroutine(ResetShapesRoutine(1f));
        //        shouldCheckWinCondition = false;
        //    }
        //break;
        case EventManager.GameEvent.EventType.StartGame:
        {
            Debug.Log("Starting Game");
            StopAllCoroutines();
            isRunning = true;
            shouldCheckWinCondition = false;
            collisionCount          = 0;
            ResetAllShapes();
            StartCoroutine(AddForce());
        }
        break;

        case EventManager.GameEvent.EventType.GameOver:
        case EventManager.GameEvent.EventType.LevelComplete:
        case EventManager.GameEvent.EventType.PauseGame:
            isRunning = false;
            break;

        case EventManager.GameEvent.EventType.ResumeGame:
            isRunning = true;
            break;

        case EventManager.GameEvent.EventType.NextLevel:
        {
            ResetAllShapes();
            StopAllCoroutines();
            isRunning      = true;
            collisionCount = 4;
            StartCoroutine(AddForce());

            break;
        }

        case EventManager.GameEvent.EventType.ShapeReset:
        {
            SetShapesActive();
            ResetShapesPosition();
            StartCoroutine(ResetShapesRoutine(1f));
            break;
        }

        case EventManager.GameEvent.EventType.InkDone:
            isRunning = true;
            break;
        }
    }
Ejemplo n.º 8
0
 private void OnGameEvent(EventManager.GameEvent obj)
 {
     if (obj.myType == EventManager.GameEvent.EventType.AllOctosFreed)
     {
         myWander.SetTarget(GameManager.Instance.TopGoal);
         myIsCaptruedOctoFreed = true;
     }
 }
Ejemplo n.º 9
0
 private void OnGameEvent(EventManager.GameEvent obj)
 {
     if (obj.myType == EventManager.GameEvent.EventType.PlayAgain)
     {
         transform.localPosition = new Vector3(3800, transform.localPosition.y, 0);
         myTarget = null;
     }
 }
Ejemplo n.º 10
0
 private void OnGameEvent(EventManager.GameEvent obj)
 {
     if (obj.myType == EventManager.GameEvent.EventType.Score)
     {
         scoreToAdd += obj.myAmount;
         UpdateScoreText();
         ScaleText();
     }
 }
Ejemplo n.º 11
0
 private void OnGameEvent(EventManager.GameEvent obj)
 {
     //if(obj.myType == EventManager.GameEvent.EventType.LifeLost)
     //{
     //    if(Lives.Count <= 0)
     //    {
     //        EventManager.GameOver();
     //    }
     //}
 }
Ejemplo n.º 12
0
 private void Start()
 {
     GameManager.instance.eventManager.NewEvent += (x) => {
         gameEvent = x;
         subWindow.SetActive(true);
         InitializeButtons();
         InitializeWindow();
         GetComponent <Image>().enabled = true;
         GameManager.instance.Pause();
     };
 }
Ejemplo n.º 13
0
 private void OnGameEvent(EventManager.GameEvent obj)
 {
     if (obj.myType == EventManager.GameEvent.EventType.Win)
     {
         MoveToWin();
     }
     else if (obj.myType == EventManager.GameEvent.EventType.GoToLevelSelect)
     {
         MoveToLevelSelect();
     }
 }
Ejemplo n.º 14
0
    private void OnGameEvent(EventManager.GameEvent obj)
    {
        switch (obj.myType)
        {
        case EventManager.GameEvent.EventType.StartGame:
            shouldCheckForInput    = true;
            circleCollider.enabled = false;
            break;

        case EventManager.GameEvent.EventType.NewWave:
        {
            shouldCheckForInput    = true;
            circleCollider.enabled = false;
            taggedShapes.Clear();
            break;
        }

        case EventManager.GameEvent.EventType.ShapeReset:
        {
            line.positionCount = 0;
            ResetLines();
            break;
        }

        case EventManager.GameEvent.EventType.WaveComplete:
        case EventManager.GameEvent.EventType.PreScore:
        case EventManager.GameEvent.EventType.GameOver:
        case EventManager.GameEvent.EventType.LevelComplete:
            shouldCheckForInput = false;
            ResetLines();
            Debug.Log("WaveComplete, GameOver or LevelComplete");
            break;

        case EventManager.GameEvent.EventType.PauseGame:
        {
            shouldCheckForInput = false;
            break;
        }

        case EventManager.GameEvent.EventType.ResumeGame:
        {
            shouldCheckForInput = true;
            break;
        }

        case EventManager.GameEvent.EventType.NextLevel:
        {
            taggedShapes.Clear();
            shouldCheckForInput = true;
            break;
        }
        }
    }
Ejemplo n.º 15
0
 private void OnGameEvent(EventManager.GameEvent obj)
 {
     //if(obj.myType == EventManager.GameEvent.EventType.Win && myScoreType == ScoreType.Win)
     //{
     //    myScore++;
     //    UpdateText("Wins: ");
     //}
     //else if(obj.myType == EventManager.GameEvent.EventType.Lose && myScoreType == ScoreType.Lose)
     //{
     //    myScore++;
     //    UpdateText("Loses: ");
     //}
 }
Ejemplo n.º 16
0
 private void OnGameEvent(EventManager.GameEvent obj)
 {
     if (obj.myType == EventManager.GameEvent.EventType.BiggerBall)
     {
         sizeMultiplier = obj.myAmountF;
         if (pressedObject != null)
         {
             var rt = pressedObject.GetComponent <RectTransform>();
             rt.sizeDelta = rt.sizeDelta * sizeMultiplier;
         }
         StartCoroutine(ResetSize(obj.myDurration));
     }
 }
Ejemplo n.º 17
0
 private void OnGameEvent(EventManager.GameEvent obj)
 {
     if (obj.myType == EventManager.GameEvent.EventType.Win || obj.myType == EventManager.GameEvent.EventType.Lose)
     {
         myShouldSpawn = false;
         StopCoroutine(mySpawningRoutine);
     }
     else if (obj.myType == EventManager.GameEvent.EventType.PlayAgain)
     {
         myShouldSpawn     = true;
         mySpawningRoutine = StartCoroutine(Spawning());
     }
 }
Ejemplo n.º 18
0
    private void OnGameEvent(EventManager.GameEvent obj)
    {
        switch (obj.myType)
        {
        case EventManager.GameEvent.EventType.NextLevel:
        case EventManager.GameEvent.EventType.StartGame:
        case EventManager.GameEvent.EventType.WaveComplete:
        case EventManager.GameEvent.EventType.LevelComplete:
            UpdateText();
            break;

        default:
            break;
        }
    }
Ejemplo n.º 19
0
 private void OnGameEvent(EventManager.GameEvent obj)
 {
     if (obj.myType == EventManager.GameEvent.EventType.Win || obj.myType == EventManager.GameEvent.EventType.Lose)
     {
         StopCoroutine(mySpawnRoutine);
     }
     else if (obj.myType == EventManager.GameEvent.EventType.PlayAgain)
     {
         DestroyAllOctos();
     }
     else if (obj.myType == EventManager.GameEvent.EventType.AllOctosFreed)
     {
         StopCoroutine(mySpawnRoutine);
     }
 }
Ejemplo n.º 20
0
 private void OnGameEvent(EventManager.GameEvent obj)
 {
     switch (obj.myType)
     {
     case EventManager.GameEvent.EventType.NextLevel:
     case EventManager.GameEvent.EventType.StartGame:
     case EventManager.GameEvent.EventType.WaveComplete:
     case EventManager.GameEvent.EventType.WaveFailed:
     case EventManager.GameEvent.EventType.GameOver:
     case EventManager.GameEvent.EventType.LevelComplete:
     {
         UpdateGraphics();
         break;
     }
     }
 }
Ejemplo n.º 21
0
 private void OnGameEvent(EventManager.GameEvent obj)
 {
     //switch(obj.myType)
     //{
     //    case EventManager.GameEvent.EventType.Win:
     //        Camera.main.backgroundColor = new Color(0f, 1f, 0f, 1f);
     //        break;
     //    case EventManager.GameEvent.EventType.Lose:
     //        Camera.main.backgroundColor = new Color(1f, 0f, 0f, 1f);
     //        break;
     //    case EventManager.GameEvent.EventType.NewWave:
     //        Camera.main.backgroundColor = new Color(1f, 1f, 1f, 1f);
     //        break;
     //    case EventManager.GameEvent.EventType.NextLevel:
     //    case EventManager.GameEvent.EventType.StartGame:
     //        Camera.main.backgroundColor = new Color(1f, 1f, 1f, 1f);
     //        break;
     //}
 }
Ejemplo n.º 22
0
 private void OnGameEvent(EventManager.GameEvent obj)
 {
     if (obj.myType == EventManager.GameEvent.EventType.LifeLost)
     {
         if (HasLivesLeft() == false)
         {
             EventManager.GameOver();
         }
     }
     else if (obj.myType == EventManager.GameEvent.EventType.LifeGained)
     {
         foreach (var life in lives)
         {
             if (life.gameObject.activeSelf == false)
             {
                 life.gameObject.SetActive(true);
                 life.Recreate();
                 return;
             }
         }
     }
 }
Ejemplo n.º 23
0
    private void OnGameEvent(EventManager.GameEvent obj)
    {
        switch (obj.myType)
        {
        case EventManager.GameEvent.EventType.NextLevel:
            myLevelData = obj.myLevelData;
            SetCountDownData();
            SetCollectableData();
            break;

        case EventManager.GameEvent.EventType.WaveFailed:
            inkSplat.color = new Color(1f, 1f, 1f, 1f);
            InkVisibleComplete();
            break;

        case EventManager.GameEvent.EventType.QuitGame:
            break;

        default:
            break;
        }
    }
Ejemplo n.º 24
0
    private IEnumerator DisplayMessageRoutine(TutorialMessage tutorial)
    {
        if (!tutorial.Recurring)
        {
            TutorialMessages.Remove(tutorial);
        }

        CurrentEvent = tutorial.EventTrigger;

        if (tutorial.EventTrigger == EventManager.GameEvent.GuidingCharacterHelp)
        {
            Button.interactable = true;
            Animation.Play();
        }
        else
        {
            Button.interactable = false;
            StopBlinking();
        }

        //if (tutorial.LockOtherInteraction)
        //    BackgroundTintImage.FadeIn();

        if (tutorial.AnchorPositions.Any())
        {
            StartCoroutine(MoveCharacterToAnchorPos(CharacterPositionHolder, tutorial.AnchorPositions[Random.Range(0, tutorial.AnchorPositions.Length)], !Holder.activeSelf));
        }

        if (!Holder.activeSelf)
        {
            SoundController.PlaySound(SoundController.UISound.GuidePopup);
            PuffParticles.Play();
            Holder.SetActive(true);
        }

        if (tutorial.SelectOneAtRandom)
        {
            Text.text = "";
            yield return(new WaitUntil(() => !SoundController.SpeechPlaying()));

            yield return(new WaitForSecondsRealtime(PlayLine(tutorial.Lines[Random.Range(0, tutorial.Lines.Length)].Line) + DisplayTime));
        }
        else
        {
            foreach (var t in tutorial.Lines)
            {
                Text.text = "";
                yield return(new WaitUntil(() => !SoundController.SpeechPlaying()));

                yield return(new WaitForSecondsRealtime(PlayLine(t.Line) + DisplayTime));
            }
        }

        //if (tutorial.LockOtherInteraction)
        //    BackgroundTintImage.FadeOut();

        if (MessageQueue.Any())
        {
            StartCoroutine(DisplayMessageRoutine(MessageQueue.Dequeue()));
        }
        else if (tutorial.EventTrigger != EventManager.GameEvent.GuidingCharacterHelp)
        {
            Close();
        }
    }
Ejemplo n.º 25
0
 public void SetEvent(EventManager.GameEvent _gameEvent)
 {
     gameEvent = _gameEvent;
 }