void AttempToMove(Vector2 position) { MDTile tile = MapManager.shared.map.GetTileAt((int)position.x, (int)position.y); MDObject obj = MapManager.shared.map.GetObjectAt(position); MDUnit unit = MapManager.shared.map.GetUnitAt(position); if (tile == null || tile.solid || (tile.liquid && !onBoat)) { Debug.Log("Solid surface!"); } else if (obj != null && obj.solid) { Interact(obj); } else if (unit != null) { if (unit.friendly) { Talk(unit); } else { Attack(unit); } } else { _transform.position = position; MapManager.shared.UpdateChunks(); } }
// Установить юнит по координатам public bool SetUnitAt(Vector2 position, MDUnit unit) { if (units.ContainsKey(position)) { return(false); } else { units.Add(position, unit); return(true); } }
void Attack(MDUnit unit) { Debug.Log("Attack!"); }
void Talk(MDUnit unit) { Debug.Log("Talk!"); }