public void BuildBuilding(int type, int subtype, int index) { Entity t = TriIsland.GetBuildingPrefabs(type, subtype, index); Selector.Instance.RequestLocation((Unit)selected, new BuildCommand(t), t); Close(); }
public static new Human Load(BinaryReader reader) { Human ret = Instantiate((Human)TriIsland.GetUnitPrefabs((int)UnitType.PERSON, 0)); TriCell tLoc = TriGrid.Instance.GetCell(TriCoordinates.Load(reader)); if (tLoc) { ret.Home = (Inn)tLoc.Statics; } else { (TriIsland.GetCamp() as Hall).Homeless.Add(ret); } tLoc = TriGrid.Instance.GetCell(TriCoordinates.Load(reader)); if (tLoc) { ret.Company = (Company)tLoc.Statics; } tLoc = TriGrid.Instance.GetCell(TriCoordinates.Load(reader)); if (tLoc) { ret.Work = tLoc.Statics; } return(ret); }
public new static TerrainModder Load(BinaryReader reader) { int workType = reader.ReadInt32(); TerrainModder ret = Instantiate((TerrainModder)TriIsland.GetBuildingPrefabs((int)BuildingType.WORKSITE, (int)WorkType.TERRAINMODDER, workType)); return(ret); }
public void RequestLocation(Unit subject, Command c, Entity prefab = null) { this.subject = subject; command = c; ordering = true; terrainSelectionViewer.enabled = true; Prefab = subject ? prefab : TriIsland.GetBuildingPrefabs((int)BuildingType.HALL, 0, 0); }
public static new BuildCommand Load(BinaryReader reader) { TriGrid instance = TriGrid.Instance; TriCell tCell = instance.GetCell(TriCoordinates.Load(reader)); TriDirection tDir = (TriDirection)reader.ReadInt32(); Entity prefab = TriIsland.GetBuildingPrefabs(reader.ReadInt32(), reader.ReadInt32(), 0); return(new BuildCommand(tCell, tDir, prefab)); }
public void CreateHall(TriDirection dir, TriCell cell) { Hall ret = (Hall)CreateBuilding(dir, cell, (Building)TriIsland.GetBuildingPrefabs((int)BuildingType.HALL, (int)HallType.BASE, 0)); if (ret) { TriIsland.Instance.entities.camp = ret; for (int i = 0; i < 4; i++) { Unit t = CreateUnit(ret.EntranceLocation, (Unit)TriIsland.GetUnitPrefabs((int)UnitType.PERSON, 0)); ((Human)t).Home = null; t.AddCommand(new GetInCommand(ret)); } ret.Working = true; } }
public override IEnumerator GoHome() { CancelAllAct(); if (Home) { AddCommand(new MoveCommand(Home.EntranceLocation, true, true)); AddCommand(new GetInCommand(Home)); } else { AddCommand(new MoveCommand(TriIsland.GetCamp().EntranceLocation, true, true)); AddCommand(new GetInCommand(TriIsland.GetCamp())); } acting = false; ActResult = true; yield return(null); }
void Awake() { try { SaveName = Intent.GetData <string>(Strings.SaveInd); } catch (KeyNotFoundException e) { SceneManager.LoadScene(0); } DirectoryInfo di = new DirectoryInfo(Application.persistentDataPath + "/save/" + SaveName + "/" + IsleName); if (IsleName != Strings.NaN) { IslePath = di.FullName; if (di.Exists == false) { di.Create(); } } Instance = this; }
public static new Farmland Load(BinaryReader reader) { return(Instantiate((Farmland)TriIsland.GetBuildingPrefabs((int)BuildingType.WORKSITE, (int)WorkType.FARMLAND, 0))); }
public new static LoggingFacility Load(BinaryReader reader) { LoggingFacility ret = (LoggingFacility)Instantiate(TriIsland.GetBuildingPrefabs((int)BuildingType.COMPANY, (int)CompType.CONSTRUCTOR, 0)); return(ret); }
IEnumerator <WaitForEndOfFrame> SetTerrainType() { for (int i = 0; i < cellCount; i++) { TriCell cell = grid.GetCell(i), hexCell = grid.GetCell(TriMetrics.TriToHex(cell.coordinates)); if (cell.coordinates == hexCell.coordinates) { float moisture = climate[hexCell.Index].moisture; TriDirection d = TriDirection.VERT; TriIsland isle = TriIsland.Instance; for (int j = 0; j < 6; j++) { if (!cell) { break; } if (!cell.IsUnderwater) { if (cell.Elevation > 10) { cell.TerrainTypeIndex = 4; } else if (moisture < 0.02f) { cell.TerrainTypeIndex = 3; if (Random.value < 0.5f && !cell.HasRiver) { Tree t = (Tree)Instantiate(TriIsland.GetNaturalPrefabs((int)NaturalType.TREE, 0), isle.transform); t.Location = cell; t.EntranceDirection = (TriDirection)((int)(Random.value * 3f)); entities.AddNatural(t); } } else if (moisture < 0.12f) { cell.TerrainTypeIndex = 2; if (Random.value < 0.2f && !cell.HasRiver) { Tree t = (Tree)Instantiate(TriIsland.GetNaturalPrefabs((int)NaturalType.TREE, 0), isle.transform); t.Location = cell; t.EntranceDirection = (TriDirection)((int)(Random.value * 3f)); entities.AddNatural(t); } } else if (moisture < 0.20f) { cell.TerrainTypeIndex = 1; } else if (moisture < 0.85f) { cell.TerrainTypeIndex = 0; } else { cell.TerrainTypeIndex = 0; } } else { cell.TerrainTypeIndex = 1; } cell = cell.GetNeighbor(d); if (hexCell.inverted) { d = d.Next(); } else { d = d.Previous(); } } if (i % Metrics.refreshLimit == 0) { yield return(null); } } } }
public new static WareHouse Load(BinaryReader reader) { WareHouse ret = (WareHouse)Instantiate(TriIsland.GetBuildingPrefabs((int)BuildingType.COMPANY, (int)CompType.WAREHOUSE, 0)); return(ret); }
public new static Mine Load(BinaryReader reader) { Mine ret = (Mine)Instantiate(TriIsland.GetBuildingPrefabs((int)BuildingType.WORKSITE, (int)WorkType.MINE, 0)); return(ret); }
public new static Tree Load(BinaryReader reader) { Tree ret = Instantiate((Tree)TriIsland.GetNaturalPrefabs((int)NaturalType.TREE, 0)); return(ret); }
public override void Tick() { base.Tick(); if (Clock.IsDay()) { if (Work) { RoutineTarget = Work; } else if (Company) { RoutineTarget = Company; } else if (Home) { RoutineTarget = Home; } else { RoutineTarget = TriIsland.GetCamp(); } } else { if (Home) { RoutineTarget = Home; } else { RoutineTarget = TriIsland.GetCamp(); } } if (nowWork == null && !acting && commandQueue.Count == 0 && RoutineTarget && RoutineTarget != Building) { CancelAllAct(); Debug.LogWarning("<color=#ff0000>act canceled</color> and moved to : " + routineTarget); TriGrid inst = TriGrid.Instance; inst.FindPath(Location, routineTarget.EntranceLocation, true, true); if (inst.HasPath) { inst.ClearPath(); AddCommand(new MoveCommand(RoutineTarget.EntranceLocation, true, true)); AddCommand(new GetInCommand(RoutineTarget)); } else { inst.ClearPath(); if (RoutineTarget == Work) { AddCommand(new ChangeWorkCommand(null)); } else if (RoutineTarget == Company) { AddCommand(new ChangeJobCommand(null)); } else if (RoutineTarget == Home) { AddCommand(new ChangeHomeCommand(null)); } } } }
public static new Camp Load(BinaryReader reader) { return(Instantiate((Camp)TriIsland.GetBuildingPrefabs((int)BuildingType.HALL, (int)HallType.BASE, 0))); }
public static new Tent Load(BinaryReader reader) { return(Instantiate((Tent)TriIsland.GetBuildingPrefabs((int)BuildingType.INN, (int)InnType.TENT, 0))); }
public void LoadIsland() { TriIsland isle = TriIsland.Instance; isle.Load(Focus.IslePath); }
public new static Processor Load(BinaryReader reader) { Processor ret = (Processor)Instantiate(TriIsland.GetBuildingPrefabs((int)BuildingType.COMPANY, (int)CompType.PROCESSOR, 0)); return(ret); }
public void Start() { island = TriIsland.Instance; }