/// <summary> /// Обновляет клетку в листе клеток и просит пересовать её /// </summary> /// <param name="cell"> Клетка, которую обновляем </param> /// <param name="newType"> Новый тип этой клетки </param> public static void UpdateCellList(Cell cell, Cell.TypeOfCell newType) { if (cell.Surface != Cell.TypeOfCell.Empty) { if ((int)newType < (int)Cell.TypeOfCell.Sea || (int)newType > (int)Cell.TypeOfCell.Basalt) { CellLists[(int)cell.Content].Remove(cell.Coordinate); } else { CellLists[(int)cell.Surface].Remove(cell.Coordinate); } } if (cell.Surface != Cell.TypeOfCell.Empty || newType != Cell.TypeOfCell.Empty) { CellLists[(int)newType].Add(cell.Coordinate); } if ((int)newType < (int)Cell.TypeOfCell.Sea || (int)newType > (int)Cell.TypeOfCell.Basalt) { RenderingScript.UpdateTypeCell(cell); } }
void Update() { if (RenderingScript.CurrentStepsRendering <= TimeManager.TimeSpeed && RenderingScript.RenderingMode != RenderModeEnum.RenderingType.Rewind) { RenderingScript.MaxStepsRendering = TimeManager.TimeSpeed; } if (RenderingScript.CurrentStepsRendering > RenderingScript.MaxStepsRendering) { if (RenderingScript.RenderingMode == RenderModeManager.RenderingMode) { if (RenderingScript.RenderingMode != RenderModeEnum.RenderingType.Rewind) { RenderingScript.CurrentStepsRendering = 0; } if (SavesManager.NeedLoadGame) { LoadGame(); } else { NextTurn(); } } else { RenderingScript.CurrentStepsRendering = 0; if (SavesManager.NeedLoadGame) { LoadGame(); } else { NextTurn(); } RenderingScript.RenderingMode = RenderModeManager.RenderingMode; foreach (Cell cell in Map.WorldMap) { RenderingScript.UpdateTypeCell(cell); } } } else { if (RenderingScript.CurrentStepsRendering == 0) { if (RenderingScript.RenderingMode != RenderModeEnum.RenderingType.Rewind) { RenderingScript.StartRendering(); } } else { if (RenderingScript.RenderingMode == RenderModeEnum.RenderingType.Rewind) { RenderingScript.HideObjects(); } else { RenderingScript.UpdateObjects(); } } RenderingScript.CurrentStepsRendering++; } }