//TODO: NewStructureCreation - Move to Player void NewStructureCreation() { if (!newStructurePlot && Player.instance.focusedOn && Player.instance.focusedOn.GetComponent <Plot>()) { newStructurePlot = Player.instance.focusedOn.GetComponent <Plot>(); return; } if (Input.GetAxis("Horizontal2") != 0 || Input.GetAxis("Vertical2") != 0) { Vector3 newPosition = createNewStructure.transform.position + new Vector3(Input.GetAxis("Horizontal2") * 10 * Time.deltaTime, 0, Input.GetAxis("Vertical2") * 10 * Time.deltaTime); newPosition = new Vector3(Mathf.Clamp(newPosition.x, newStructurePlot.transform.position.x - newStructurePlot.transform.localScale.x * 0.5f, newStructurePlot.transform.position.x + newStructurePlot.transform.localScale.x * 0.5f), newPosition.y, Mathf.Clamp(newPosition.z, newStructurePlot.transform.position.z - newStructurePlot.transform.localScale.z * 0.5f, newStructurePlot.transform.position.z + newStructurePlot.transform.localScale.z * 0.5f)); createNewStructure.transform.position = newPosition; } else if (Input.GetAxis("Mouse X") != 0 || Input.GetAxis("Mouse Y") != 0) { if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hitInfo, 100, LayerMask.GetMask("Terrain")) && new Rect(newStructurePlot.transform.position.x - newStructurePlot.transform.localScale.x * 0.5f, newStructurePlot.transform.position.z - newStructurePlot.transform.localScale.z * 0.5f, newStructurePlot.transform.localScale.x, newStructurePlot.transform.localScale.z).Contains(new Vector2(hitInfo.point.x, hitInfo.point.z))) { createNewStructure.transform.position = hitInfo.point; } else { createNewStructure.transform.position = newStructurePlot.transform.position; } } if (Input.GetButtonDown("PrimaryAction")) { createNewStructure.Create(); createNewStructure = null; newStructurePlot = null; } if (Input.GetButtonDown("Cancel") || Input.GetButtonDown("SecondaryAction")) { Destroy(createNewStructure.gameObject); createNewStructure = null; newStructurePlot = null; } }
public override string Print(bool link = true, DwarfObject pov = null) { string eventString = GetYearTime(); eventString += SiteEntity != null?SiteEntity.ToLink(link, pov) : "UNKNOWN ENTITY"; eventString += " of "; eventString += Civ != null?Civ.ToLink(link, pov) : "UNKNOWN CIV"; eventString += " replaced "; eventString += OldStructure != null?OldStructure.ToLink(link, pov) : "UNKNOWN STRUCTURE"; eventString += " in "; eventString += Site != null?Site.ToLink(link, pov) : "UNKNOWN SITE"; eventString += " with "; eventString += NewStructure != null?NewStructure.ToLink(link, pov) : "UNKNOWN STRUCTURE"; eventString += "."; return(eventString); }