public int destroyTime = 5000; // milliseconds (ms) // LIFECYCLE // void Start() { // Once the object has been initially transformed, // in the Realm, fire this projectile. TPObject.get(this.transform.parent.gameObject).OnTransform += delegate { this.FullSend(); }; }
public void chunk() { print("chunking"); float maxZ = bound.max.z; float maxX = bound.max.x; Vector3 size = bound.size; edge_len = Mathf.Min(size.x, size.z) / (float)resolution; // print("\nEdge length for the voxels:"); // print(edge_len); Vector3 start = bound.min; // print("\nSTART"); // print(start); float currX = start.x; float currZ = start.z; float fulltimeY = start.y + bound.extents.y; //TODO find out why it is only making an L smh while (currZ < maxZ) { //print("\nX.."); while (currX < maxX) { spawnPositions.Add(new Vector3(currX, fulltimeY, currZ)); currX += edge_len; // print("CURR X:"); // print(currX); } // reset x: currX = start.x; //print("Z.."); spawnPositions.Add(new Vector3(currX, fulltimeY, currZ)); currZ += edge_len; // print("\nCURR Z:"); // print(currZ); } // print("\nEND- Bound max: "); // print(bound.max); // print("\nLength of spawns: "); // print(spawnPositions.Count); // print(spawnPositions); foreach (Vector3 pos in spawnPositions) { GameObject go = Instantiate(this.voxelPrefab, pos, Quaternion.identity); TPObject tpo = TPObject.get(go); this.spawnVoxels.Add(tpo); } }
void Update() { // still here.. if (Input.GetKeyDown(KeyCode.G)) { this.ToggleGod(); } if (Input.GetKeyDown(KeyCode.T)) { GameObject voxelGO = Instantiate(this.VoxelTPO); TPObject voxelTPO = TPObject.get(voxelGO); voxelTPO.OnInit += delegate { Transform t = TPUser.SelfUser.transform; Vector3 pos = t.position; Vector3 ang = t.eulerAngles; // pos.z += 1; voxelTPO.transform.position = pos; voxelTPO.transform.eulerAngles = ang; }; } }
public void ButtonSelected(int index) { string prefabName; switch (index) { case 0: // victim prefabName = "victim_marker"; break; case 1: // hazard prefabName = "caution_marker"; break; case 2: // landmark prefabName = "landmark_marker"; break; default: prefabName = "victim_marker"; break; } GameObject markerGO = Instantiate(this.MarkerTpoPrefab); TPObject markerTPO = TPObject.get(markerGO); markerTPO.OnInit += delegate { Transform t = TPUser.SelfUser.transform; Vector3 pos = t.position; Vector3 ang = t.eulerAngles; // pos.z += 1; markerTPO.transform.position = pos; // markerTPO.transform.eulerAngles = ang; // set marker prefab renderer markerTPO.SetState("prefab", prefabName); }; }
void Update() { // If the player taps the screen (or left-clicks the mouse) // and is already authenticated with this realm in Teleportal... if (Input.GetMouseButtonDown(0) && Teleportal.AuthModule.Shared.IsAuthed()) { // Get the Transform of this player's camera. Transform t = Camera.main.transform; // Apply that transform to a new laser object. // (see the Laser Prefab TPObject in the Unity inspector) GameObject laser = Instantiate(this.LaserPrefab, t.position, t.rotation); // Wait for the TPObject to initialize across the network... TPObject tpo = TPObject.get(laser); tpo.OnInit += delegate { // Then force update the transform. // This is necessary when instantiating a TPObject // with a specific position and rotation in the world. tpo.UpdateRemoteTransform(); }; } }
void Start() { this.tpo = TPObject.get(this.transform.parent.gameObject); this.tpo.Subscribe("god", this.OnSetGod); IncidentCommand.onClick.AddListener(() => OnIncidentCommandClicked()); FirstResponder.onClick.AddListener(() => OnFirstResponderClicked()); this.tpo.Subscribe("cam", delegate(string value) { string[] components = value.Split(':'); string user = components[0]; if (!SlimeScreenCapture.Shared.screenRxEnabled || !this.iAmGod || // TODO remove this line to enable floating screens (also see TPUser prefab) user == Teleportal.Teleportal.tp.GetUsername()) { return; } if (screens.ContainsKey(user)) { string byteStr = components[1]; StartCoroutine(ShowC(user, byteStr)); } }); }
// helper method private void DestroyLaser() { GameObject laser = this.gameObject.transform.parent.gameObject; TPObject.get(laser).Delete(); }
void Start() { this.tpo = TPObject.get(this.transform.parent.gameObject); this.tpo.Subscribe("explored", this.OnExplored); }
///// LIFECYCLE ///// void Awake() { this.tpo = TPObject.get(this); this.forceComponent = this.GetComponent <ConstantForce>(); }