private void setStatsText(int mode, Transform t, DestructibleBehaviour db) { switch (mode) { case 0: string volStr = "Volume-\n"+db.getCurrentVolume().ToString("F2"); statsTextObject.GetComponent<Text> ().text = volStr; break; case 1: string[] things = new string[3]; int numthings = 0; float[] dim = db.getDimensions(); switch (db.type) { case "cube": things[0] = "L-"+dim[0].ToString("F2"); things[1] = "W-"+dim[1].ToString("F2"); things[2] = "H-"+dim[2].ToString("F2"); numthings = 3; break; case "sphere": things[0] = "R-"+dim[3].ToString("F2"); numthings = 1; break; case "cylinder": things[0] = "R-"+dim[3].ToString("F2"); things[1] = "H-"+dim[2].ToString("F2"); numthings = 2; break; case "cone": things[0] = "R-"+dim[3].ToString("F2"); things[1] = "H-"+dim[2].ToString("F2"); numthings = 2; break; } string text = ""; for (int i=0; i<numthings; i++) { text += " " + things[i] + "\n"; } statsTextObject.GetComponent<Text> ().text = text; break; } }
void Start() { db = this.GetComponent<DestructibleBehaviour> (); peh = primaryEventObj.GetComponent<PrimaryEventHandler> (); oh = objcHandlerObj.GetComponent<ObjectiveHandler> (); }
void Start() { db = GetComponent<DestructibleBehaviour> (); startTime = Time.time; }