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

        CommandStackProxy.Get().Undo();
        m_IsUndoing = false;
    }
Beispiel #2
0
 private void AddBinSpawnCommand()
 {
     if (LevelManagerProxy.Get().GetMode() == ELevelMode.MaxBin)
     {
         BinSpawnCommand command = new BinSpawnCommand(gameObject);
         command.Execute();
         CommandStackProxy.Get().PushCommand(command);
     }
 }
Beispiel #3
0
 private void AddToggleGrabCommand()
 {
     if (CanToggleGrab())
     {
         ToggleGrabCommand command = new ToggleGrabCommand(gameObject);
         command.Execute();
         CommandStackProxy.Get().PushCommand(command);
     }
 }
Beispiel #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);
     }
 }
Beispiel #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);
     }
 }
Beispiel #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));
    }
Beispiel #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();
     }
 }
Beispiel #8
0
 public void SetSpawnedCommandNumber()
 {
     m_SpawnedAtCommandNumber = CommandStackProxy.Get().GetNumberOfCommand();;
 }
Beispiel #9
0
 public bool IsSpawnedAtCommandNumber()
 {
     return(m_SpawnedAtCommandNumber == CommandStackProxy.Get().GetNumberOfCommand() + 1);
 }