void facePosition() { if (isInitialised == false || PoliceController.me.currentRoomSwat == null) { return; } if (pos == Vector3.zero) { if (PoliceController.me.buildingUnderSiege == null) { pos = this.transform.position + this.transform.forward; } else { roomRect r = PoliceController.me.currentRoomSwat.getRectIAmIn(this.transform.position); if (r == null) { pos = PoliceController.me.currentRoomSwat.getCenter(); } else { pos = r.getCenterPoint(); } } } myController.pmc.rotateToFacePosition(pos); }
public void addNewRoomRect() { if (rectsInBuilding == null) { rectsInBuilding = new List <roomRect> (); } GameObject myObj = (GameObject)Instantiate(new GameObject(), this.transform); myObj.name = buildingName + " Room rect " + rectsInBuilding.Count; roomRect rc = myObj.AddComponent <roomRect>(); rc.bottomLeft = Instantiate(new GameObject(), this.transform.position - new Vector3(-1, -1, 0), Quaternion.Euler(0, 0, 0)).transform; rc.bottomLeft.transform.parent = myObj.transform; rc.topRight = Instantiate(new GameObject(), this.transform.position - new Vector3(1, 1, 0), Quaternion.Euler(0, 0, 0)).transform; rc.topRight.transform.parent = myObj.transform; rc.bottomLeft.gameObject.name = buildingName + " bottom left " + rectsInBuilding.Count; rc.topRight.gameObject.name = buildingName + " top right " + rectsInBuilding.Count; rectsInBuilding.Add(rc); }
void facePosition() { if (pos == Vector3.zero) { if (PoliceController.me.currentRoomSwat == null) { pos = CommonObjectsStore.player.transform.position; } else { roomRect r = PoliceController.me.currentRoomSwat.getRectIAmIn(this.transform.position); if (r == null) { pos = PoliceController.me.currentRoomSwat.getCenter(); } else { pos = r.getCenterPoint(); } } } myController.pmc.rotateToFacePosition(pos); }