IEnumerator Undo() { m_IsUndoing = true; yield return(new WaitForSeconds(1f / m_UndoPerSecond)); CommandStackProxy.Get().Undo(); m_IsUndoing = false; }
private void AddBinSpawnCommand() { if (LevelManagerProxy.Get().GetMode() == ELevelMode.MaxBin) { BinSpawnCommand command = new BinSpawnCommand(gameObject); command.Execute(); CommandStackProxy.Get().PushCommand(command); } }
private void AddToggleGrabCommand() { if (CanToggleGrab()) { ToggleGrabCommand command = new ToggleGrabCommand(gameObject); command.Execute(); CommandStackProxy.Get().PushCommand(command); } }
private void AddTurnCommand(int facingDirection) { if (CanTurn(facingDirection)) { TurnCommand command = new TurnCommand(gameObject, facingDirection, (int)m_FacingDirection); command.Execute(); CommandStackProxy.Get().PushCommand(command); } }
private void AddMoveCommand(int xDir, int yDir) { if (CanMoveTo(xDir, yDir)) { MoveCommand command = new MoveCommand(gameObject, xDir, yDir); command.Execute(); CommandStackProxy.Get().PushCommand(command); } }
public void SpawnBin(int binNumber) { if (!TileManagerProxy.Get().GetTile(GetCoordinates()).IsEmpty()) { new DialogueEvent("Cannot Spawn").Push(); CommandStackProxy.Get().PopCommand().Undo(); return; } StartCoroutine(SpawnRountine(binNumber)); }
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(); } }
public void SetSpawnedCommandNumber() { m_SpawnedAtCommandNumber = CommandStackProxy.Get().GetNumberOfCommand();; }
public bool IsSpawnedAtCommandNumber() { return(m_SpawnedAtCommandNumber == CommandStackProxy.Get().GetNumberOfCommand() + 1); }