// Use this for initialization IEnumerator Start() { yield return new WaitForSeconds(DelayTime); IVec2 MapPos = new IVec2(SpawnX, SpawnY); for (int i = 0; i < NumberOfPeople; i++) { Map.CurrentMap.AddPerson(MapPos, teamID); } foreach (var item in Map.CurrentMap.GetPeopleAt(MapPos)) { if(item.teamID == teamID) item.Skills.AddRange(PeopleSkils); } Map.CurrentMap.GetTeamData(teamID).Resources[ResourceType.Coal] = GlobleCoal; Map.CurrentMap.GetTeamData(teamID).Resources[ResourceType.Iron] = GlobleIron; Map.CurrentMap.GetTeamData(teamID).Resources[ResourceType.Ore] = GlobleOre; Map.CurrentMap.GetTeamData(teamID).Resources[ResourceType.Stone] = GlobleStone; Map.CurrentMap.GetTeamData(teamID).Resources[ResourceType.Timber] = GlobleTimber; Map.CurrentMap.GetTeamData(teamID).Resources[ResourceType.Wood] = GlobleWood; Map.CurrentMap.GetPeopleAt(MapPos)[0].ToDoList.AddRange(ActToDo); }
public override ActionResult actionTick (Person person) { PlayerData team = Map.CurrentMap.GetTeamData (person.teamID); if (destination == null) { Building nearestMine = team.GetNearestBuilding (person.currentMapPos, BuildingType.Smelter); if (nearestMine == null) { return ActionResult.FAIL; } destination = nearestMine.m_MapPos; } if (person.currentMapPos == destination) { MapObject mo = Map.CurrentMap.getObject(destination); if (mo is Building) { Building b = mo as Building; if (b.m_buildingtype == BuildingType.Smelter && team.Resources[ResourceType.Ore] > 0 && team.Resources[ResourceType.Coal] > 0) { team.Resources[ResourceType.Ore]--; team.Resources[ResourceType.Coal]--; person.Resources[ResourceType.Iron] += 1; person.ToDoList[0] = new Store(); return ActionResult.CONTINUE; } } return ActionResult.FAIL; } person.ToDoList.Insert (0, new Move (person.currentMapPos, destination)); return ActionResult.CONTINUE; }
// Use this for initialization IEnumerator Start () { yield return new WaitForSeconds(DelayTime); IVec2 MapPos = new IVec2(BuildX, BuildY); for (int i = 0; i < NumberOfPeople; i++) { Map.CurrentMap.AddPerson(MapPos, teamID); } foreach (var item in Map.CurrentMap.GetPeopleAt(MapPos)) { if (NumberOfPeople > 0 && item.teamID == teamID) { item.Skills.AddRange(PeopleSkils); NumberOfPeople--; } } Map.CurrentMap.GetTeamData(teamID).Resources[ResourceType.Coal] = GlobleCoal; Map.CurrentMap.GetTeamData(teamID).Resources[ResourceType.Iron] = GlobleIron; Map.CurrentMap.GetTeamData(teamID).Resources[ResourceType.Ore] = GlobleOre; Map.CurrentMap.GetTeamData(teamID).Resources[ResourceType.Stone] = GlobleStone; Map.CurrentMap.GetTeamData(teamID).Resources[ResourceType.Timber] = GlobleTimber; Map.CurrentMap.GetTeamData(teamID).Resources[ResourceType.Wood] = GlobleWood; if (!Map.CurrentMap.BuildBuilding(type, MapPos, teamID)) { Debug.Log("Building couldn't be built"); } }
public override ActionResult actionTick (Person person) { if (destination == null) { Building nearestMine = Map.CurrentMap.GetNearestBuilding (person.currentMapPos, BuildingType.Quarry); if (nearestMine == null) { return ActionResult.FAIL; } destination = nearestMine.m_MapPos; } if (person.currentMapPos == destination) { MapObject mo = Map.CurrentMap.getObject(destination); if (mo is Building) { Building b = mo as Building; if (b.m_buildingtype == BuildingType.Quarry) { person.Resources[ResourceType.Stone] += 1; person.ToDoList[0] = new Store(); return ActionResult.CONTINUE; } } return ActionResult.FAIL; } person.ToDoList.Insert (0, new Move (person.currentMapPos, destination)); return ActionResult.CONTINUE; }
// Use this for initialization IEnumerator Start() { yield return new WaitForSeconds(DelayTime); IVec2 MapPos = new IVec2(SpawnX, SpawnY); Map.CurrentMap.setResourcetile(type, resourceAmount, MapPos); }
public Person GetNonBusyPersonAt(IVec2 MapPos) { foreach (var item in GetPeopleAt(MapPos)) { if (item.ToDoList.Count == 0 && item.BusyTime == 0) return item; } return null; }
public Ship(IEnumerable <Action> actions) { var ship = Initial; foreach (var action in actions) { ship = new Ship(ship, action); } Pos = ship.Pos; Dir = ship.Dir; }
public WaypointShip(IEnumerable <Action> actions) { var ship = Initial; foreach (var action in actions) { ship = new WaypointShip(ship, action); } ShipPos = ship.ShipPos; WpPos = ship.WpPos; }
public List<Person> GetPeopleAt(IVec2 MapPos) { List<Person> results = new List<Person>(); foreach (var item in People) { if (item.currentMapPos == MapPos) results.Add(item); } return results; }
public SeatMap(string input) { var lines = input.Trim().Split('\n').Select(l => l.Trim()).Where(l => l.Length > 0).ToArray(); Size = new IVec2(lines[0].Length, lines.Length); Seats = lines.SelectMany(l => l.Select(c => c switch { '.' => SeatState.Floor, 'L' => SeatState.Empty, '#' => SeatState.Occupied, _ => throw new InvalidDataException() })).ToArray();
public List<Person> GetPeopleAtBuilding(Building b) { List<Person> result = new List<Person>(); IVec2 offset = new IVec2(); IVec2 size = Building.Sizes[b.m_buildingtype]; for (offset.x = -size.x / 2; offset.x < size.x / 2; offset.x++) { for (offset.y = -size.y / 2; offset.y < size.y / 2; offset.y++) { result.AddRange(GetPeopleAt(b.m_MapPos + offset)); } } return result; }
public static IVec2 Subtract(IVec2 first, params IVec2[] vecs) { if (vecs.Length == 0) { return(first); } IVec2 vec = first.GetNewInstance(first.X, first.Y); for (int i = 0; i < vecs.Length; i++) { vec.X -= vecs[i].X; vec.Y -= vecs[i].Y; } return(vec); }
public static IVec2 Add(params IVec2[] vecs) { if (vecs.Length == 0) { return(null); } IVec2 ret = vecs[0].GetNewInstance(0, 0); for (int i = 0; i < vecs.Length; i++) { ret.X += vecs[i].X; ret.Y += vecs[i].Y; } return(ret); }
public override ActionResult actionTick (Person person) { if (destination == null) { ResourceTile tile = Map.CurrentMap.GetNearestResourceTile (person.currentMapPos, type); Building nearestMine = Map.CurrentMap.GetNearestBuilding (person.currentMapPos, BuildingType.Mine); float distanceToTile = (tile.m_MapPos - person.currentMapPos).magnitude (); float distanceToBuilding = nearestMine != null ? (nearestMine.m_MapPos - person.currentMapPos).magnitude () : float.MaxValue; if (distanceToTile > distanceToBuilding) { destination = nearestMine.m_MapPos; } else { destination = tile.m_MapPos; } } if (person.currentMapPos == destination) { MapObject mo = Map.CurrentMap.getObject(destination); if (mo is Building) { Building b = mo as Building; if (b.m_buildingtype == BuildingType.Mine && person.Skills.Contains(Skill.Miner)) { person.Resources[type] += 1; person.ToDoList[0] = new Store(); return ActionResult.CONTINUE; } else { return ActionResult.FAIL; } } if (mo is ResourceTile) { ResourceTile rt = mo as ResourceTile; if (rt.m_resource == type) { person.Resources[rt.m_resource] += rt.GatherResource(type); person.SetBusy(5); person.ToDoList[0] = new Store(); return ActionResult.CONTINUE; } else { return ActionResult.FAIL; } } } person.ToDoList.Insert (0, new Move (person.currentMapPos, destination)); return ActionResult.CONTINUE; }
public override ActionResult actionTick (Person person) { if (buildPos == null) { buildPos = Map.CurrentMap.FindLocationToBuild (person.currentMapPos, type); } if (buildPos != null) { if (person.currentMapPos == buildPos) { bool success = Map.CurrentMap.BuildBuilding(type, buildPos, person.teamID); if (success) { return ActionResult.SUCCESS; } else { return ActionResult.FAIL; } } person.ToDoList.Insert (0, new Move (person.currentMapPos, buildPos)); return ActionResult.CONTINUE; } return ActionResult.FAIL; }
public override ActionResult actionTick (Person person) { if (person.Skills.Contains(Skill.Rifleman)) { List<Person> others = new List<Person>(); for(IVec2 offset = new IVec2(-5,-5); offset.x < 6;++offset.x) { for(offset.y = -5; offset.y < 6;++offset.y) { if(offset.magnitude() <= 5) { others.AddRange(Map.CurrentMap.GetPeopleAt(person.currentMapPos + offset)); } } } Person other = null; foreach (var item in others) { if(item.teamID != person.teamID) { other = item; break; } } if(other) { if(other.Skills.Contains(Skill.Rifleman) && UnityEngine.Random.Range(0,100) < (100.0f/3f * 2f)) { Map.CurrentMap.KillPerson(person); } else { Map.CurrentMap.KillPerson(other); person.SetBusy(1); } } } return ActionResult.FAIL; }
public Ship(Ship prevShip, Action action) { Pos = prevShip.Pos; Dir = prevShip.Dir; switch (action.Kind) { case ActionKind.North: Pos += North * action.Value; break; case ActionKind.South: Pos += South * action.Value; break; case ActionKind.East: Pos += East * action.Value; break; case ActionKind.West: Pos += West * action.Value; break; case ActionKind.Left: Dir = Dir.Rotate90(-action.Value); break; case ActionKind.Right: Dir = Dir.Rotate90(+action.Value); break; case ActionKind.Forward: Pos += Dir * action.Value; break; default: throw new NotImplementedException(); } }
public WaypointShip(WaypointShip prevShip, Action action) { ShipPos = prevShip.ShipPos; WpPos = prevShip.WpPos; switch (action.Kind) { case ActionKind.North: WpPos += North * action.Value; break; case ActionKind.South: WpPos += South * action.Value; break; case ActionKind.East: WpPos += East * action.Value; break; case ActionKind.West: WpPos += West * action.Value; break; case ActionKind.Left: WpPos = WpPos.Rotate90(-action.Value); break; case ActionKind.Right: WpPos = WpPos.Rotate90(+action.Value); break; case ActionKind.Forward: ShipPos += WpPos * action.Value; break; default: throw new NotImplementedException(); } }
public bool SpaceToBuild(BuildingType type, IVec2 pos) { IVec2 offset = new IVec2(); IVec2 size = Building.Sizes[type]; for (offset.x = -size.x / 2; offset.x < size.x / 2; offset.x++) { for (offset.y = -size.y / 2; offset.y < size.y / 2; offset.y++) { IVec2 vec = offset + pos; if (entities[vec.x, vec.y] != null || OutBounds.Contains(mapTiles[vec.x, vec.y])) { return false; } } } return true; }
Person GetNonBusyPersonInBuildingWithSkill(Skill wantedSkill) { IVec2 offset = new IVec2(); IVec2 size = Building.Sizes[m_buildingtype]; for (offset.x = -size.x / 2; offset.x < size.x / 2; offset.x++) { for (offset.y = -size.y / 2; offset.y < size.y / 2; offset.y++) { foreach (var item in Map.CurrentMap.GetPeopleAt(m_MapPos + offset)) { if (item.Skills.Contains(wantedSkill) && item.ToDoList.Count == 0 && item.teamID == teamID) { return item; } } } } return null; }
public static Vector3 getTilePos (IVec2 pos) { return getTilePos (pos.x, pos.y); }
public char getTile (IVec2 pos) { return getTile (pos.x, pos.y); }
public Building GetNearestBuilding (IVec2 Pos, BuildingType type) { Building nearestBuilding = null; int nearestDistance = int.MaxValue; foreach (MapObject mo in entities) { if (mo is Building) { Building b = mo as Building; if (b.m_buildingtype == type) { int distance = Pos.manhatttanDistance(b.m_MapPos); if (distance < nearestDistance){ nearestDistance = distance; nearestBuilding = b; } } } } return nearestBuilding; }
//used only for testing public void setResourcetile (ResourceType type, int ResourceAmount, IVec2 MapPos) { ResourceTile t = new ResourceTile (); t.setTile (type, MapPos, ResourceAmount); }
public static IVec2 Scale(IVec2 vec, float scalar) { return(vec.GetNewInstance(vec.X * scalar, vec.Y * scalar)); }
public static IVec2 Scale(IVec2 vec, IVec2 scalar) { return(vec.GetNewInstance(vec.X * scalar.X, vec.Y * scalar.Y)); }
public static IVec2 Normalized(IVec2 vec) { float dist = GetLength(vec); return(vec.GetNewInstance(vec.X / dist, vec.Y / dist)); }
public static IVec2 Dot(IVec2 left, IVec2 right) { return(left.GetNewInstance(left.X * right.X, left.Y * right.Y)); }
public Ship(IVec2 pos, IVec2 dir) { Pos = pos; Dir = dir; }
public bool Equals(IVec2 other) { return(X == other.X && Y == other.Y); }
public bool BuildBuilding (BuildingType type, IVec2 Pos, int teamID, bool force) { bool isBuilding = false; if (CanBuild (type, Pos) || force) { Building newBuilding = new Building (); isBuilding = newBuilding.Build (type, Pos, teamID); if (isBuilding || force) { IVec2 offset = new IVec2(); IVec2 size = Building.Sizes[type]; for (offset.x = -size.x / 2; offset.x < size.x / 2; offset.x++) { for (offset.y = -size.y / 2; offset.y < size.y / 2; offset.y++) { IVec2 newPos = Pos + offset; entities [newPos.x, newPos.y] = newBuilding; } } GameObject obj = Instantiate (BuildingTile, Vector3.zero, Quaternion.Euler (Vector3.zero)) as GameObject; obj.renderer.material = Instantiate(GameObject.FindObjectOfType<MaterialSource>().getMaterialByName("Team" + (teamID + 1).ToString())) as Material; obj.renderer.material.mainTexture = GameObject.FindObjectOfType<MaterialSource>().getTextureByName(type.ToString()); obj.transform.SetParent(chunks[Pos.x / 32, Pos.y / 32].transform); obj.transform.position = getTileCenterPos (Pos); Vector3 oldScale = obj.transform.localScale; obj.transform.localScale = new Vector3(size.x * oldScale.x, 1 * oldScale.y, size.y * oldScale.z); obj.name = "Building" + Buildings.Count + "(" + type.ToString() + ")"; newBuilding.gameObject = obj; Buildings.Add(newBuilding); Players[teamID].Buildings.Add(newBuilding); } } return isBuilding; }
public Person GetNonBusyPersonInBuilding() { IVec2 offset = new IVec2(); IVec2 size = Building.Sizes[m_buildingtype]; for (offset.x = -size.x / 2; offset.x < size.x / 2; offset.x++) { for (offset.y = -size.y / 2; offset.y < size.y / 2; offset.y++) { foreach (var item in Map.CurrentMap.GetPeopleAt(m_MapPos + offset)) { if (item.ToDoList.Count == 0 && item.BusyTime == 0 && item.teamID == teamID) { return item; } } } } return null; }
public bool CanBuild (BuildingType type, IVec2 Pos) { bool Buildable = true; IVec2 offset = new IVec2(); IVec2 size = Building.Sizes[type]; for (offset.x = -size.x / 2; offset.x < size.x / 2; offset.x++) { for (offset.y = -size.y / 2; offset.y < size.y / 2; offset.y++) { IVec2 newPos = Pos + offset; if (!Terrain.Contains (getTile (newPos)) || getObject (newPos) is Building) { Buildable = false; } else if (type == BuildingType.Mine) { ResourceTile t = getObject (newPos) as ResourceTile; if (t == null || (t.m_resource != ResourceType.Coal && t.m_resource != ResourceType.Ore)) { Buildable = false; } } } } return Buildable; }
public static float GetLength(IVec2 vec) { return((float)Math.Sqrt(vec.X * vec.X + vec.Y * vec.Y)); }
// public ResourceTile GetNearestResourceTile (IVec2 Pos, ResourceType type) { ResourceTile nearestTile = null; int nearestDistance = int.MaxValue; foreach (MapObject mo in entities) { if (mo is ResourceTile) { ResourceTile rt = mo as ResourceTile; if (rt.m_resource == type) { int distance = Pos.manhatttanDistance(rt.m_MapPos); if (distance < nearestDistance){ nearestDistance = distance; nearestTile = rt; } } } } return nearestTile; }
public static IVec2 getTileFromPos (Vector3 worldPos) { //worldPos += new Vector3(0.5f, 0.5f, 0.5f) * MapChunk.TILE_SIZE; IVec2 mapPos = new IVec2 (Mathf.FloorToInt (worldPos.x / MapChunk.TILE_SIZE), Mathf.FloorToInt (worldPos.z / MapChunk.TILE_SIZE)); return mapPos; }
public MapObject getObject (IVec2 pos) { return getObject (pos.x, pos.y); }
public Person AddPerson (IVec2 Pos, int TeamID) { if (PersonPrefab) { GameObject go = (GameObject)Instantiate (PersonPrefab); go.renderer.material = GameObject.FindObjectOfType<MaterialSource>().getMaterialByName("Team" + (TeamID + 1).ToString()); go.name = "Person" + TeamID + Players[TeamID].People.Count; go.GetComponent<Person> ().teamID = TeamID; go.GetComponent<Person> ().SetMapPosition (Pos); People.Add (go.GetComponent<Person> ()); Person p = go.GetComponent<Person> (); Players [TeamID].People.Add (p); go.transform.parent = this.transform; return p; } return null; }
public void setTile (IVec2 pos, char tile) { setTile (pos.x, pos.y, tile); }
public bool BuildBuilding (BuildingType type, IVec2 Pos, int teamID) { return BuildBuilding (type, Pos, teamID, false); }
bool CheckForSkillWithinBuilding(Skill WantedSkill) { IVec2 offset = new IVec2(); IVec2 size = Building.Sizes[m_buildingtype]; for (offset.x = -size.x / 2; offset.x < size.x / 2; offset.x++) { for (offset.y = -size.y / 2; offset.y < size.y / 2; offset.y++) { foreach (var item in Map.CurrentMap.GetPeopleAt(m_MapPos + offset)) { if (item.Skills.Contains(WantedSkill) && item.teamID == teamID) { return true; } } } } return false; }
public IVec2 FindLocationToBuild(IVec2 startPos, BuildingType bt) { int attempts = 10; int radius = 20; for (int i = 0; i != attempts; i++) { int x = UnityEngine.Random.Range(-radius, radius); int y = UnityEngine.Random.Range(-radius, radius); IVec2 vec = new IVec2(x, y); if (SpaceToBuild(bt, startPos + vec)) { return startPos + vec; } } return null; }
public List<Person> GetPeopleInBuilding() { List<Person> result = new List<Person>(); IVec2 offset = new IVec2(); IVec2 size = Building.Sizes[m_buildingtype]; for (offset.x = -size.x / 2; offset.x < size.x / 2; offset.x++) { for (offset.y = -size.y / 2; offset.y < size.y / 2; offset.y++) { foreach (var item in Map.CurrentMap.GetPeopleAt(m_MapPos + offset)) { if (item.teamID == teamID) { result.Add(item); } } } } return result; }
public WaypointShip(IVec2 shipPos, IVec2 wpPos) { ShipPos = shipPos; WpPos = wpPos; }
//returns true if sucsessful public bool Build(BuildingType type, IVec2 mapPos, int ID) { teamID = ID; bool building = true; m_buildingtype = type; m_MapPos = mapPos; switch (m_buildingtype) { case BuildingType.turfHut: if(!CheckForSkillWithinBuilding(Skill.Labourer)) return false; break; case BuildingType.House: if(!CheckResource(ResourceType.Stone)) return false; if(!CheckResource(ResourceType.Wood)) return false; if(!CheckForSkillWithinBuilding(Skill.Carpenter)) return false; if(!CheckForSkillWithinBuilding(Skill.Labourer)) return false; break; case BuildingType.School: if(!CheckResource(ResourceType.Stone)) return false; if(!CheckResource(ResourceType.Wood)) return false; if(!CheckResource(ResourceType.Iron)) return false; if(!CheckForSkillWithinBuilding(Skill.Carpenter)) return false; if(!CheckForSkillWithinBuilding(Skill.Labourer)) return false; break; case BuildingType.Barracks: if(!CheckResource(ResourceType.Stone)) return false; if(!CheckResource(ResourceType.Wood)) return false; if(!CheckForSkillWithinBuilding(Skill.Carpenter)) return false; if(!CheckForSkillWithinBuilding(Skill.Labourer)) return false; break; case BuildingType.Storage: if(!CheckResource(ResourceType.Stone)) return false; if(!CheckResource(ResourceType.Wood)) return false; if(!CheckForSkillWithinBuilding(Skill.Carpenter)) return false; if(!CheckForSkillWithinBuilding(Skill.Labourer)) return false; break; case BuildingType.Mine: if(!CheckResource(ResourceType.Wood)) return false; if(!CheckResource(ResourceType.Iron)) return false; if(!CheckForSkillWithinBuilding(Skill.Blacksmith)) return false; if(!CheckForSkillWithinBuilding(Skill.Carpenter)) return false; if(!CheckForSkillWithinBuilding(Skill.Labourer)) return false; break; case BuildingType.Smelter: if(!CheckResource(ResourceType.Stone)) return false; if(!CheckForSkillWithinBuilding(Skill.Labourer)) return false; break; case BuildingType.Quarry: if(!CheckForSkillWithinBuilding(Skill.Labourer)) return false; break; case BuildingType.Sawmill: if(!CheckResource(ResourceType.Stone)) return false; if(!CheckResource(ResourceType.Iron)) return false; if(!CheckResource(ResourceType.Timber)) return false; if(!CheckForSkillWithinBuilding(Skill.Labourer)) return false; break; case BuildingType.Forge: if(!CheckResource(ResourceType.Stone)) return false; if(!CheckResource(ResourceType.Iron)) return false; if(!CheckResource(ResourceType.Timber)) return false; if(!CheckForSkillWithinBuilding(Skill.Labourer)) return false; break; default: building = false; break; } if (building) { //Spend Resource and set Busy timers //all require a labourer //GetNonBusyPersonInBuildingWithSkill(Skill.Labourer).SetBusy(BuildTime[m_buildingtype]); PlayerData CurrentTeamData = Map.CurrentMap.GetTeamData(teamID); switch (m_buildingtype) { case BuildingType.House: CurrentTeamData.Resources[ResourceType.Stone]--; CurrentTeamData.Resources[ResourceType.Wood]--; GetNonBusyPersonInBuildingWithSkill(Skill.Carpenter).SetBusy(BuildTime[m_buildingtype]); break; case BuildingType.School: CurrentTeamData.Resources[ResourceType.Stone]--; CurrentTeamData.Resources[ResourceType.Wood]--; CurrentTeamData.Resources[ResourceType.Iron]--; GetNonBusyPersonInBuildingWithSkill(Skill.Carpenter).SetBusy(BuildTime[m_buildingtype]); break; case BuildingType.Barracks: CurrentTeamData.Resources[ResourceType.Stone]--; CurrentTeamData.Resources[ResourceType.Wood]--; GetNonBusyPersonInBuildingWithSkill(Skill.Carpenter).SetBusy(BuildTime[m_buildingtype]); break; case BuildingType.Storage: CurrentTeamData.Resources[ResourceType.Stone]--; CurrentTeamData.Resources[ResourceType.Wood]--; GetNonBusyPersonInBuildingWithSkill(Skill.Carpenter).SetBusy(BuildTime[m_buildingtype]); break; case BuildingType.Mine: CurrentTeamData.Resources[ResourceType.Wood]--; CurrentTeamData.Resources[ResourceType.Iron]--; GetNonBusyPersonInBuildingWithSkill(Skill.Carpenter).SetBusy(BuildTime[m_buildingtype]); GetNonBusyPersonInBuildingWithSkill(Skill.Blacksmith).SetBusy(BuildTime[m_buildingtype]); break; case BuildingType.Smelter: CurrentTeamData.Resources[ResourceType.Stone]--; break; case BuildingType.Sawmill: CurrentTeamData.Resources[ResourceType.Stone]--; CurrentTeamData.Resources[ResourceType.Iron]--; CurrentTeamData.Resources[ResourceType.Timber]--; break; case BuildingType.Forge: CurrentTeamData.Resources[ResourceType.Stone]--; CurrentTeamData.Resources[ResourceType.Iron]--; CurrentTeamData.Resources[ResourceType.Timber]--; break; default: break; } } return building; }
public static float GetDistance(IVec2 vec1, IVec2 vec2) { IVec2 dir = Subtract(vec1, vec2); return(GetLength(dir)); }