Example #1
0
 private void OnMouseUp()
 {
     if (m_IsVisible && !UpdaterProxy.Get().IsPaused())
     {
         new OnEdgeClick("Game", this).Push();
     }
 }
 public override void OnEnter()
 {
     UpdaterProxy.Get().SetPause(true);
     this.RegisterAsListener("Game", typeof(GameFlowEvent));
     this.RegisterAsListener("Player", typeof(PlayerInputGameEvent));
     new PauseEvent(true).Push();
 }
 public override void OnExit()
 {
     new PauseEvent(false).Push();
     this.UnregisterAsListener("Player");
     this.UnregisterAsListener("Game");
     UpdaterProxy.Get().SetPause(false);
 }
Example #4
0
 private void OnMouseEnter()
 {
     if (!UpdaterProxy.Get().IsPaused())
     {
         m_Sprite.color = Color.green;
     }
 }
Example #5
0
 public void Stop()
 {
     DumpStack();
     UpdaterProxy.Get().Unregister(this, EUpdatePass.Last);
     ClearStack();
     m_TransitionQueue.Clear();
 }
Example #6
0
 public override void OnEnter()
 {
     UpdaterProxy.Get().SetPause(true);
     Time.timeScale = 0;
     PlayerManagerProxy.Get().ResetStat();
     this.RegisterAsListener("Game", typeof(GameFlowEvent));
 }
Example #7
0
 public override void OnEnter()
 {
     // TODO: Edge enter logic
     UpdaterProxy.Get().SetPause(true);
     m_Player = GameObject.FindGameObjectWithTag("Player").GetComponent <OverworldPlayerController> ();
     this.RegisterAsListener("Game", typeof(GameFlowEvent));
 }
Example #8
0
    public void ChoosePath()
    {
        m_CurrentEdge.GetEdgeResource().SetNormal();

        new CameraFollowEvent().Push();

        switch (m_MoveType)
        {
        case EEdgeType.Normal:
            m_Player.OnNormalEdge(m_CurrentEdge);
            break;

        case EEdgeType.Combat:
            new OnEdgeBattleGameEvent(true, m_CurrentEdge).Push();
            m_Player.OnEdge(m_CurrentEdge, true);
            break;

        case EEdgeType.Obstacle:
            break;

        case EEdgeType.Diversion:
            new OnDiversionEvent().Push();
            m_Player.OnEdge(m_CurrentEdge, true);
            break;
        }

        gameObject.SetActive(false);
        UpdaterProxy.Get().SetPause(false);
    }
Example #9
0
    public void OnGameEvent(OnEdgeClick edgeEvent)
    {
        gameObject.SetActive(true);
        UpdaterProxy.Get().SetPause(true);
        m_CurrentEdge = edgeEvent.GetEdge();
        m_ChoosePathButton.interactable = m_Player.CanMoveToEdge(m_CurrentEdge);

        EdgeResource tempEdgeResource = m_CurrentEdge.GetEdgeResource();

        switch (tempEdgeResource.GetEdgeType())
        {
        case EEdgeType.Normal:
            m_MoveType = EEdgeType.Normal;
            break;

        case EEdgeType.Combat:
            if (TeamManagerProxy.Get().IsNotTooMuchCharacters(tempEdgeResource.GetEdgeCharacterNumber()))
            {
                m_MoveType = EEdgeType.Normal;
            }
            else
            {
                m_MoveType = EEdgeType.Combat;
            }
            break;

        case EEdgeType.Obstacle:
            if (TeamManagerProxy.Get().IsCharacterClass(tempEdgeResource.GetEdgeCharacterClass()))
            {
                m_MoveType = EEdgeType.Normal;
            }
            else
            {
                m_MoveType = EEdgeType.Obstacle;
                m_ChoosePathButton.interactable = false;
            }
            break;

        case EEdgeType.Diversion:
            if (TeamManagerProxy.Get().IsNotTooMuchCharacters(tempEdgeResource.GetEdgeCharacterNumber()))
            {
                m_MoveType = EEdgeType.Normal;
            }
            else
            {
                m_MoveType = EEdgeType.Diversion;
            }
            break;
        }

        m_Description.text = tempEdgeResource.GetDescription();
    }
    void Update()
    {
        if (UpdaterProxy.Get().IsPaused())
        {
            return;
        }

        if (m_FollowPlayer)
        {
            GameObject player = GameObject.FindGameObjectWithTag("Player");
            transform.position = new Vector3(player.transform.position.x, player.transform.position.y, transform.position.z);
        }
    }
Example #11
0
    public void OnGameEvent(PlayerInputGameEvent inputEvent)
    {
        if (UpdaterProxy.Get().IsPaused() || !m_ProcessInput)
        {
            return;
        }
        string      input = inputEvent.GetInput();
        EInputState state = inputEvent.GetInputState();

        switch (input)
        {
        case "Jump":
            if (state == EInputState.Down)
            {
                Jump();
            }
            break;

        case "Right":
            Move(state == EInputState.Held ? 1 : 0);
            ChangeFacingDirection(m_Right);
            break;

        case "Left":
            Move(state == EInputState.Held ? -1 : 0);
            ChangeFacingDirection(m_Left);
            break;

        case "Blast":
            if (state == EInputState.Down)
            {
                Fire();
            }
            break;

        case "Slash":
            if (state == EInputState.Down)
            {
                Slash();
            }
            break;

        default:
            break;
        }
    }
Example #12
0
    public void OnGameEvent(GameFlowEvent flowEvent)
    {
        switch (flowEvent.GetAction())
        {
        case EGameFlowAction.StartDialogue:
            UpdaterProxy.Get().SetPause(true);
            ChangeNextTransition(HSMTransition.EType.Child, typeof(GameFlowDialogueState));
            break;

        case EGameFlowAction.EndDialogue:
            UpdaterProxy.Get().SetPause(false);
            break;

        case EGameFlowAction.EndLevel:
            ChangeNextTransition(HSMTransition.EType.Clear, typeof(GameFlowEndLevelState));
            break;
        }
    }
Example #13
0
    IEnumerator SpawnRountine(int binNumber)
    {
        m_Animator.SetBool("IsSpawning", true);
        SoundManagerProxy.Get().PlayMultiple(m_FallingSound);
        UpdaterProxy.Get().SetPause(true);
        yield return(new WaitForSeconds(1f));

        GameObject      binGameObject = GameObject.Instantiate(m_BinPrefab);
        TileCoordinates coordinates   = GetCoordinates();

        binGameObject.transform.position = new Vector3(coordinates.x.ToWorldUnit(), coordinates.y.ToWorldUnit(), 0);
        Bin bin = binGameObject.GetComponent <Bin> ();

        bin.Init(ETileObjectType.Bin, coordinates.x, coordinates.y, new string[] { binNumber.ToString() });
        bin.SetSpawnedCommandNumber();
        TileManagerProxy.Get().SetTileObject(coordinates, bin);
        ms_BinNumber++;

        UpdaterProxy.Get().SetPause(false);
        m_Animator.SetBool("IsSpawning", false);
    }
Example #14
0
 public static void UnregisterToUpdate(this System.Object objectToNotify, params EUpdatePass[] updatePassList)
 {
     UpdaterProxy.Get().Unregister(objectToNotify, updatePassList);
 }
Example #15
0
 public static void RegisterToUpdate(this System.Object objectToNotify, bool isPausable, params EUpdatePass[] updatePassList)
 {
     UpdaterProxy.Get().Register(objectToNotify, isPausable, updatePassList);
 }
Example #16
0
 public GameEventManager()
 {
     m_Notifiers      = new Dictionary <string, ListenerNotifier> ();
     m_GameEventQueue = new Queue <GameEvent> ();
     UpdaterProxy.Get().Register(this, EUpdatePass.First);
 }
Example #17
0
 public void Start(StateID firstStateID)
 {
     PushState(firstStateID);
     UpdaterProxy.Get().Register(this, EUpdatePass.Last);
     DumpStack();
 }
 public override void OnExit()
 {
     this.UnregisterAsListener("Game");
     UpdaterProxy.Get().SetPause(false);
 }
Example #19
0
 public void OnGameEvent(PlayerInputGameEvent inputEvent)
 {
     if (inputEvent.GetInput() == "Pause" && inputEvent.GetInputState() == EInputState.Down && !UpdaterProxy.Get().IsPaused())
     {
         ChangeNextTransition(HSMTransition.EType.Child, typeof(GameFlowPauseState));
     }
 }
Example #20
0
 public void Cancel()
 {
     m_CurrentEdge = null;
     gameObject.SetActive(false);
     UpdaterProxy.Get().SetPause(false);
 }
 public override void OnEnter()
 {
     UpdaterProxy.Get().SetPause(true);
     this.RegisterAsListener("Game", typeof(GameFlowEvent));
 }
Example #22
0
    public void OnGameEvent(PlayerInputGameEvent inputEvent)
    {
        if (UpdaterProxy.Get().IsPaused())
        {
            return;
        }

        string      input = inputEvent.GetInput();
        EInputState state = inputEvent.GetInputState();

        if (state == EInputState.Down)
        {
            switch (input)
            {
            case "TurnRight":
                AddTurnCommand((int)EFacingDirection.Right);
                break;

            case "TurnLeft":
                AddTurnCommand((int)EFacingDirection.Left);
                break;

            case "TurnUp":
                AddTurnCommand((int)EFacingDirection.Up);
                break;

            case "TurnDown":
                AddTurnCommand((int)EFacingDirection.Down);
                break;

            case "Grab / Ungrab":
                AddToggleGrabCommand();
                break;

            case "BinSpawnRequest":
                AddBinSpawnCommand();
                break;

            default:
                break;
            }
        }
        if (state == EInputState.Held || state == EInputState.Down)
        {
            switch (input)
            {
            case "Right":
                AddMoveCommand(1, 0);
                break;

            case "Left":
                AddMoveCommand(-1, 0);
                break;

            case "Up":
                AddMoveCommand(0, 1);
                break;

            case "Down":
                AddMoveCommand(0, -1);
                break;

            case "Undo":
                m_TimeHoldingUndo += Time.deltaTime;
                if (!m_IsUndoing && (m_TimeHoldingUndo > m_HeldUndoTreshold || state == EInputState.Down))
                {
                    StartCoroutine(Undo());
                }
                break;

            default:
                break;
            }
        }
        if (state == EInputState.Up && input == "Undo")
        {
            m_TimeHoldingUndo = 0f;
        }
    }