Exemple #1
0
    IEnumerator Undo()
    {
        m_IsUndoing = true;
        yield return(new WaitForSeconds(1f / m_UndoPerSecond));

        CommandStackProxy.Get().Undo();
        m_IsUndoing = false;
    }
Exemple #2
0
 private void AddBinSpawnCommand()
 {
     if (LevelManagerProxy.Get().GetMode() == ELevelMode.MaxBin)
     {
         BinSpawnCommand command = new BinSpawnCommand(gameObject);
         command.Execute();
         CommandStackProxy.Get().PushCommand(command);
     }
 }
Exemple #3
0
 private void AddToggleGrabCommand()
 {
     if (CanToggleGrab())
     {
         ToggleGrabCommand command = new ToggleGrabCommand(gameObject);
         command.Execute();
         CommandStackProxy.Get().PushCommand(command);
     }
 }
Exemple #4
0
 private void AddTurnCommand(int facingDirection)
 {
     if (CanTurn(facingDirection))
     {
         TurnCommand command = new TurnCommand(gameObject, facingDirection, (int)m_FacingDirection);
         command.Execute();
         CommandStackProxy.Get().PushCommand(command);
     }
 }
Exemple #5
0
 private void AddMoveCommand(int xDir, int yDir)
 {
     if (CanMoveTo(xDir, yDir))
     {
         MoveCommand command = new MoveCommand(gameObject, xDir, yDir);
         command.Execute();
         CommandStackProxy.Get().PushCommand(command);
     }
 }
Exemple #6
0
    public void SpawnBin(int binNumber)
    {
        if (!TileManagerProxy.Get().GetTile(GetCoordinates()).IsEmpty())
        {
            new DialogueEvent("Cannot Spawn").Push();
            CommandStackProxy.Get().PopCommand().Undo();
            return;
        }

        StartCoroutine(SpawnRountine(binNumber));
    }
Exemple #7
0
 public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
 {
     if (GetActiveSceneName() == "Level")
     {
         TileManagerProxy.Get().Reset();
         GoalManagerProxy.Get().Reset();
         CommandStackProxy.Get().Reset();
         m_NumberOfMove = 0;
         string levelName = GetCurrentLevelName();
         m_LevelDimension = LevelParser.GenLevel("/" + levelName + ".txt");
         new LevelEvent(m_CurrentLevel, true).Push();
         new BinSpawnEvent(true, 0).Push();
         new DialogueEvent(levelName + "-start").Push();
     }
 }
Exemple #8
0
    // This should be called before any other gameobject awakes
    private void Awake ()
    {
        // Singleton pattern : this is the only case where it should be used
        if(ms_Instance == null)
        {
            ms_Instance = this;
            DontDestroyOnLoad (gameObject);
            
            // Keep the Updater first, as the other members might want to register to it
            m_Logger = new UnityLogger ();
            LoggerProxy.Open (m_Logger);
            m_Updater = new Updater ();
            UpdaterProxy.Open (m_Updater);
            m_GameEventManager = new GameEventManager ();
            GameEventManagerProxy.Open (m_GameEventManager);
            m_InputManager = new InputManager ();
            InputManagerProxy.Open (m_InputManager);
            m_LevelManager = new LevelManager ();
            LevelManagerProxy.Open (m_LevelManager);
            m_TileManager = new TileManager ();
            TileManagerProxy.Open (m_TileManager);
            m_CommandStack = new CommandStack ();
            CommandStackProxy.Open (m_CommandStack);
            m_GoalManager = new GoalManager ();
            GoalManagerProxy.Open (m_GoalManager);
            m_SoundManager = new SoundManager ();
            SoundManagerProxy.Open (m_SoundManager);
            m_SoundManager.SetMusicSource (m_MusicSource);
            m_SoundManager.SetFXSource (m_EfxSource);

            m_GameFlowHSM = new GameFlowHSM ();
            m_GameFlowHSM.Start (typeof (GameFlowMenuState));
        }
        else if (ms_Instance != this)
        {
            Destroy (gameObject);
            return;
        }
    }
Exemple #9
0
 public void SetSpawnedCommandNumber()
 {
     m_SpawnedAtCommandNumber = CommandStackProxy.Get().GetNumberOfCommand();;
 }
Exemple #10
0
 public bool IsSpawnedAtCommandNumber()
 {
     return(m_SpawnedAtCommandNumber == CommandStackProxy.Get().GetNumberOfCommand() + 1);
 }