public static Color GetColorOfMapElement(MapElement element) { Color colorResult = Color.White; if (element.ElementState == MapElementState.Free) { colorResult = Color.White; Color colorWithLight = new Color((AmbientLight * element.Light * colorResult.ToVector3())); colorWithLight = new Color(colorWithLight.R, colorWithLight.G, colorWithLight.B, colorResult.A); colorResult = colorWithLight; } else if (element.ElementState == MapElementState.MiningScheduled) colorResult = Color.Orange; else if (element.ElementState == MapElementState.ChobbingScheduled) colorResult = Color.Orange; else if (element.ElementState == MapElementState.WheatFieldScheduled) colorResult = Color.White; else if (element.ElementState == MapElementState.CannabisFieldScheduled) colorResult = Color.Green; if (element.Level == 2) colorResult = Color.Yellow; if (element.Unconstructed == true) { colorResult = new Color(colorResult.R, colorResult.G, colorResult.B, 0.5f); } return colorResult; }
//public static bool IsCursorOpperationValidOnCube(CursorMode mode, Cube cube) //{ // if (cube == null) // return false; // if (mode == CursorMode.None) // return true; // if (mode == CursorMode.Mine && // (cube.ElementType == MapElementType.Rock) // ) // { // return true; // } // return false; //} public static bool IsCursorOpperationValidOnMapElement(CursorMode mode, MapElement element) { if (element == null) return false; if (mode == CursorMode.Mine && ( element.ElementType == MapElementType.Rock || element.ElementType == MapElementType.IronOreCube ) && element.Position.Z == WorldMap.Instance.GetSurfacePoint() ) return true; else if ((mode == CursorMode.CropArea || mode == CursorMode.Pasture) && element.Position.Z == WorldMap.Instance.GetSurfacePoint() + 1 && element.ElementState == MapElementState.Free) { if (WorldMap.Instance.GetMapElement(element.Position.X, element.Position.Y, element.Position.Z - 1) != null) return false; return true; } else if (mode == CursorMode.PlacingBuilding && element.ElementEffect == MapElementEffect.Moveable) return true; else if (mode == CursorMode.PlacingWorldObject && element.ElementEffect == MapElementEffect.Moveable) { return true; } //if (mode == CursorMode.Chopping && element.ElementType == MapElementType.Tree) //{ // return true; //} return false; }
public void AddMapElement(MapElement element) { if (element.Position.Z == 0 && element.Solid == true) _astar.SetTile(element.Position.X, element.Position.Y, new TileInfo() { tileType = TileInfo.TileType.Wall }); _mapElements[element.Position.X, element.Position.Y, element.Position.Z] = element; }
public static float GetProcessingTimeForMapElement(MapElement element) { if (element.ElementType == MapElementType.Dirt) return 0.1f; else if (element.ElementType == MapElementType.Rock) return 0.1f; throw new Exception("Crap"); }
public static Color GetColorOfMapElement(MapElement element) { if (element.ElementState == MapElementState.Free) return Color.White; else if (element.ElementState == MapElementState.MiningScheduled) return Color.Orange; else if (element.ElementState == MapElementState.ChobbingScheduled) return Color.Orange; return Color.White; }
public override void PlaceOnMap() { base.PlaceOnMap(); _mapElement = new StoneWallQube(Position); _mapElement.ElementEffect = MapElementEffect.Nonmoveable; _mapElement.Unconstructed = true; WorldMap.Instance.AddMapElement(_mapElement); }
public static float DamageMapElement(MapElement element, Dwarf d) { if (element.ElementType == MapElementType.Grass) return 0.1f; else if (element.ElementType == MapElementType.Rock) return 0.1f; else if (element.ElementType == MapElementType.IronOreCube) return 0.1f; throw new Exception("Crap"); }
//public static bool IsCursorOpperationValidOnCube(CursorMode mode, Cube cube) //{ // if (cube == null) // return false; // if (mode == CursorMode.None) // return true; // if (mode == CursorMode.Mine && // (cube.ElementType == MapElementType.Rock) // ) // { // return true; // } // return false; //} public static bool IsCursorOpperationValidOnMapElement(CursorMode mode, MapElement element) { if (element == null) return false; if (mode == CursorMode.Mine && element.ElementType == MapElementType.Rock && element.Position.Z == 0 ) { return true; } if (mode == CursorMode.Chopping && element.ElementType == MapElementType.Tree) { return true; } return false; }
private void RequestPathfinding(MapElement element, Dwarf dwarf) { if (WorldMap.Instance.GetMapElement(element.Position.X + 1, element.Position.Y, element.Position.Z) == null || WorldMap.Instance.GetMapElement(element.Position.X + 1, element.Position.Y, element.Position.Z).ElementEffect != MapElementEffect.Solid) { AsyncPathfinding.RequestPathfinding(dwarf, new Point((int)dwarf.Position.X, (int)dwarf.Position.Y), new Point(element.Position.X + 1, element.Position.Y), null); _numberOfPathRequests++; } if (WorldMap.Instance.GetMapElement(element.Position.X - 1, element.Position.Y, element.Position.Z) == null || WorldMap.Instance.GetMapElement(element.Position.X - 1, element.Position.Y, element.Position.Z).ElementEffect != MapElementEffect.Solid) { AsyncPathfinding.RequestPathfinding(dwarf, new Point((int)dwarf.Position.X, (int)dwarf.Position.Y), new Point(element.Position.X - 1, element.Position.Y), null); _numberOfPathRequests++; } if (WorldMap.Instance.GetMapElement(element.Position.X, element.Position.Y + 1, element.Position.Z) == null || WorldMap.Instance.GetMapElement(element.Position.X, element.Position.Y + 1, element.Position.Z).ElementEffect != MapElementEffect.Solid) { AsyncPathfinding.RequestPathfinding(dwarf, new Point((int)dwarf.Position.X, (int)dwarf.Position.Y), new Point(element.Position.X, element.Position.Y + 1), null); _numberOfPathRequests++; } if (WorldMap.Instance.GetMapElement(element.Position.X, element.Position.Y - 1, element.Position.Z) == null || WorldMap.Instance.GetMapElement(element.Position.X, element.Position.Y - 1, element.Position.Z).ElementEffect != MapElementEffect.Solid) { AsyncPathfinding.RequestPathfinding(dwarf, new Point((int)dwarf.Position.X, (int)dwarf.Position.Y), new Point(element.Position.X, element.Position.Y - 1), null); _numberOfPathRequests++; } }
public MineMapElementTask(MapElement mapElement) { MapElement = mapElement; TaskType = Tasks.TaskType.Mining; }
public void AddMapElement(MapElement element) { if (element.Position.Z == _surfacePoint && element.ElementEffect == MapElementEffect.Solid) _astar.SetTile(element.Position.X, element.Position.Y, new TileInfo() { tileType = TileInfo.TileType.Wall }); _mapElements[element.Position.X, element.Position.Y, element.Position.Z] = element; }
public Task(MapElement element, TaskType task) { TaskType = task; Element = element; PercentDone = 0; }
public void SetDimentions(Vector3Int dim) { Dimentions = dim; MapElements = new MapElement[dim.X, dim.Y, dim.Z]; }
public void AddMapElement(int x, int y, int z, MapElement element) { MapElements[x, y, z] = element; element.Level = Level; }
public void SetActionMapElement(MapElement element) { _actionMapElement = element; }