/// <summary> /// </summary> /// <param name="point">Position at map</param> /// <param name="c">Tile</param> /// <param name="color"></param> public void DrawInGameZone(Vector point, char c, ConsoleColor color = ConsoleColor.White) { _drawer.DrawInGameZone(point - CameraPositionAtMap, c, color); }
protected bool CanMove(Vector newLocation) { return true; //todo }
public void DrawAtAbsolutePoint(Vector point, char c, ConsoleColor color = ConsoleColor.White) { _drawer.DrawAtAbsolutePoint(point, c, color); }
public void DrawAtAbsolutePoint(Vector point, string s, ConsoleColor color = ConsoleColor.White) { _drawer.DrawAtAbsolutePoint(point.X, point.Y, s, color); }
private void SetCameraPosition() { Settings settings = LastSettings; Vector gameZoneCenter = settings.UIGamezoneEnd - settings.UIGamezoneBegin; gameZoneCenter.X /= 2; gameZoneCenter.Y /= 2; _cameraPositionAtScreen = settings.UIGamezoneBegin + gameZoneCenter; }
private void SetCameraPosition(Vector point) { Settings settings = LastSettings; _cameraPositionAtScreen.X = point.X < settings.UIGamezoneBegin.X ? settings.UIGamezoneBegin.X : point.X > settings.UIGamezoneEnd.X ? settings.UIGamezoneEnd.X : point.X; _cameraPositionAtScreen.X = point.X < settings.UIGamezoneBegin.X ? settings.UIGamezoneBegin.X : point.X > settings.UIGamezoneEnd.X ? settings.UIGamezoneEnd.X : point.X; }
private bool HasCollision(GameObject gameObject, Vector point) { return false; //todo }
/// <summary> /// </summary> /// <param name="point">Позиция относительно активной камеры</param> /// <param name="c"></param> /// <param name="color"></param> public void DrawInGameZone(Vector point, char c, ConsoleColor color = ConsoleColor.White) { Settings settings = _settingsProvider.Setting; Vector absolutePoint = point + _cameraPositionAtScreen; //вне пределов зоны отрисовки карты if (absolutePoint.X < settings.UIGamezoneBegin.X || absolutePoint.Y < settings.UIGamezoneBegin.Y || absolutePoint.X > settings.UIGamezoneEnd.X || absolutePoint.Y > settings.UIGamezoneEnd.Y) return; DrawAtAbsolutePoint(absolutePoint, c, color); }
/// <summary> /// Добавить объект на карту и поменять его координаты /// </summary> /// <param name="gameObject"></param> /// <param name="point"></param> /// <param name="enableObject"></param> public void Add(GameObject gameObject, Vector point, bool enableObject = true) { Add(gameObject, point.X, point.Y, enableObject); }
public bool CanMoveObject(GameObject gameObject, Vector point) { return point.X >= 0 && point.Y >= 0 && point.X < Width && point.Y < Height && !HasCollision(gameObject, point); //todo }
public IList<GameObject> this[Vector point] { get { return this[point.X, point.Y]; } }
public GameObject this[Vector point, int z] { get { return this[point.X, point.Y, z]; } set { this[point.X, point.Y, z] = value; } }
private bool CanMoveObject(GameObject gameObject, Vector point) { return point.X >= 0 && point.Y >= 0 && point.X < _map.GetLength(0) && point.Y < _map.GetLength(1); //todo }
public bool MoveObject(GameObject gameObject, Vector point) { if (!CanMoveObject(gameObject, point)) return false; this[gameObject.Position].Remove(gameObject); this[point].Add(gameObject); return true; }
public int GetPointCount(Vector point) { return GetPointCount(point.X, point.Y); }