public static bbStructure GenerateStructure(bbStructureType _type, bbPos _pos, ClickType _clickType) { if (_type == bbStructureType.STRUCTURE_HQ) { return(new bbStructureHQ(_type, _pos)); } else if (_type == bbStructureType.STRUCTURE_MINE) { return(new bbStructureMine(_type, _pos)); } else if (_type == bbStructureType.STRUCTURE_FARM) { return(new bbStructureFarm(_type, _pos)); } else if (_type == bbStructureType.STRUCTURE_HOUSE) { return(new bbStructureHouse(_type, _pos)); } else if (_type == bbStructureType.STRUCTURE_CONSTRUCTION) { return(new bbStructureConstruction(_type, _pos, _clickType)); } else { return(new bbStructureEx(_type, _pos)); } }
public void AddStructure(bbStructureType t, float x, float y, ClickType _clickType) { bbLoc l = new bbLoc(x, y); bbStructure s = bbStructureFactory.GenerateStructure(t, pathMap[l.key()], _clickType); structures[s.getPos()] = s; //Debug.Log("Added Structure at " + s.getPos().getName()); }
List <bbStructure> getStructuresOfType(bbStructureType structureType) { List <bbStructure> structuresOfType = new List <bbStructure>(); foreach (bbStructure s in game.currentIsland.structures.Values) { if (s.getType() == structureType) { structuresOfType.Add(s); } } return(structuresOfType); }
public bbStructure findClosestStructureByRange(bbStructureType structureType) { List <bbStructure> structuresOfType = getStructuresOfType(structureType); float minDistance = float.PositiveInfinity; bbStructure closestStructure = structuresOfType[0]; foreach (bbStructure s in structuresOfType) { float sDistance = DistanceMinkowski(this, s.getPos()); if (sDistance < minDistance) { minDistance = sDistance; closestStructure = s; } } return(closestStructure); }
public bool findClosestStructureByPath(bbStructureType structureType, ref bbStructure closestStructure) { List <bbStructure> structuresOfType = getStructuresOfType(structureType); if (structuresOfType.Count != 0) { closestStructure = structuresOfType[0]; float minDistance = float.PositiveInfinity; foreach (bbStructure s in structuresOfType) { float sDistance = DistancePath(this, s.getPos()); if (sDistance < minDistance) { minDistance = sDistance; closestStructure = s; } } return(true); } else { return(false); } }
public bbStructureConstruction(bbStructureType _type, bbPos _pos, ClickType _clickType) { pos = _pos; structureType = _type; clickType = _clickType; }
public bbStructureEx(bbStructureType _structureType, bbPos _pos) { structureType = _structureType; pos = _pos; }
public bbStructureHouse(bbStructureType _type, bbPos _pos) { pos = _pos; structureType = _type; spawned = false; }
public bbStructureMine(bbStructureType _type, bbPos _pos) { pos = _pos; structureType = _type; hasResource = false; }
public bbStructureHQ(bbStructureType _type, bbPos _pos) { pos = _pos; structureType = _type; }