// events void OnTriggerEnter(Collider otherObj) { if (otherObj.gameObject.tag == "Dust") { Vector3 dist = transform.position - otherObj.attachedRigidbody.transform.position; float distMag = dist.magnitude; if (distMag > COLLISION_RADIUS) { if (heldObject == null && Time.realtimeSinceStartup - holdRequestInitateTime < HOLD_TIME_LENIENCY) { heldObject = otherObj.attachedRigidbody; } } else if (heldObject != otherObj.attachedRigidbody) { this.type = otherObj.gameObject.GetComponent <StarDust>().DustType; this.GetComponent <MeshFilter>().mesh = otherObj.gameObject.GetComponent <StarDust>().findMesh(type); Destroy(otherObj.gameObject); } } else if (otherObj.gameObject.tag == "PassWall") { if (type != otherObj.GetComponent <PassWall>().type&& !lockLife) { lockLife = true; life--; myo.GetComponent <ThalmicMyo>().Vibrate(VibrationType.Short); if (life <= 0) { if ((GameObject.Find("Player1").GetComponent <Ship>().Life <= 0)) { if (opposingShip.GetComponent <Ship>().Life <= 0) { GameObject.Find("Spawner").GetComponent <UIDriver>().showStateText("Just... Wow.\nPunch The Screen\nTo Play Again"); } else { GameObject.Find("Spawner").GetComponent <UIDriver>().showStateText("Player 1 Has Died\nPunch The Screen\nTo Play Again"); } } else { if (opposingShip.GetComponent <Ship>().Life <= 0) { GameObject.Find("Spawner").GetComponent <UIDriver>().showStateText("Both Of You Suck.\nPunch The Screen\nTo Play Again"); } else { GameObject.Find("Spawner").GetComponent <UIDriver>().showStateText("Player 2 Has Died\nPunch The Screen\nTo Play Again"); } } GameObject.Find("Spawner").GetComponent <UIDriver>().showHUD(false); } else { GameObject.Find("Spawner").GetComponent <UIDriver>().showHUD(true); } } } }
void SpawnWall(DustTypes passWallType, float zset) { GameObject passWallInstance = (GameObject)Instantiate(passWall, new Vector3(0, 0, zset), Quaternion.AngleAxis(-90, new Vector3(1, 0, 0))); passWalls.Add(passWallInstance); PassWall script = passWallInstance.GetComponent <PassWall> (); script.Setup(passWallType, velocity.z); script.Removed += new PassWall.WallRemoved(wallRemoved); }
private DustTypes[] failingTypes(DustTypes passingType) { switch (passingType) { case DustTypes.CUBE: return(new DustTypes[] { DustTypes.SPERE, DustTypes.TRIANGLE }); case DustTypes.SPERE: return(new DustTypes[] { DustTypes.CUBE, DustTypes.TRIANGLE }); case DustTypes.TRIANGLE: return(new DustTypes[] { DustTypes.SPERE, DustTypes.CUBE }); } return(new DustTypes[] {}); }
public Mesh findMesh(DustTypes dustType) { switch (dustType) { case DustTypes.CUBE: return CUBE; case DustTypes.SPERE: return SPERE; case DustTypes.TRIANGLE: return TRIANGLE; } return null; }
private void updatePassWall(GameObject obj) { if (obj.GetComponent <Nemesis>().passWalls.Count > 0) { prevPassWall = obj.GetComponent <Nemesis>().passWalls[0].GetComponent <PassWall>().type; showGateWarning(true); } else { showGateWarning(false); } }
public Color findMatterial(DustTypes dustType) { switch (dustType) { case DustTypes.CUBE: return Color.blue; case DustTypes.SPERE: return Color.green; case DustTypes.TRIANGLE: return Color.magenta; } return Color.black; }
public void spawnDust(DustTypes type, Vector3 pos) { GameObject newDust = (GameObject)Instantiate(startDust, pos, Quaternion.identity); dust.Add(newDust); StarDust script = newDust.GetComponent <StarDust> (); script.Removed += new StarDust.DustRemoved(dustRemoved); script.DustType = type; script.Velocity = velocity; script.spin(); }
public Material findMatterial(DustTypes dustType) { switch (dustType) { case DustTypes.CUBE: return cubeMat; case DustTypes.SPERE: return sphereMat; case DustTypes.TRIANGLE: return triangleMat; } return null; }
public Color findMatterial(DustTypes dustType) { switch (dustType) { case DustTypes.CUBE: return(Color.blue); case DustTypes.SPERE: return(Color.green); case DustTypes.TRIANGLE: return(Color.magenta); } return(Color.black); }
public Mesh findMesh(DustTypes dustType) { switch (dustType) { case DustTypes.CUBE: return(CUBE); case DustTypes.SPERE: return(SPERE); case DustTypes.TRIANGLE: return(TRIANGLE); } return(null); }
public Material findMatterial(DustTypes dustType) { switch (dustType) { case DustTypes.CUBE: return(cubeMat); case DustTypes.SPERE: return(sphereMat); case DustTypes.TRIANGLE: return(triangleMat); } return(null); }
public void createSector(ref float zset, int dif) { DustTypes pass = (DustTypes)Random.Range(0, 3); float start = zset; DustTypes[] failing = failingTypes(pass); changeSpeed(new Vector3(0, 0, -(15 + 4 * dif))); if (plans.Count > 0) { for (int i = 0; i < 10; ++i) { createPlan(new DustTypes[] { pass }, failing, ref zset, plans[Random.Range(0, plans.Count)]); } } int pspawns = Mathf.Max(3, 10 - dif); for (int i = 0; i < pspawns; ++i) { spawnDust(pass, new Vector3(Random.Range(-10.0f, 10.0f), Random.Range(-5.0f, 5.0f), Random.Range(start, zset))); } int dspawns = Mathf.Min(70, 30 + 4 * dif); for (int i = 0; i < dspawns; ++i) { spawnDust(failing[Random.Range(0, failing.Length)], new Vector3(Random.Range(-10.0f, 10.0f), Random.Range(-5.0f, 5.0f), Random.Range(start, zset))); } zset += 20; SpawnWall(pass, zset); zset += 30; }
void SpawnWall(DustTypes passWallType, float zset) { GameObject passWallInstance = (GameObject)Instantiate(passWall, new Vector3(0, 0, zset), Quaternion.AngleAxis(-90, new Vector3(1,0,0))); passWalls.Add (passWallInstance); PassWall script = passWallInstance.GetComponent<PassWall> (); script.Setup(passWallType, velocity.z); script.Removed += new PassWall.WallRemoved (wallRemoved); }
private DustTypes[] failingTypes(DustTypes passingType) { switch (passingType) { case DustTypes.CUBE: return new DustTypes[]{DustTypes.SPERE,DustTypes.TRIANGLE}; case DustTypes.SPERE: return new DustTypes[]{DustTypes.CUBE,DustTypes.TRIANGLE}; case DustTypes.TRIANGLE: return new DustTypes[]{DustTypes.SPERE,DustTypes.CUBE}; } return new DustTypes[]{}; }
private void createPlan(DustTypes[] pass, DustTypes[] fail, ref float zset, Plan plan) { Vector3 dpos = new Vector3 (0, 0, zset); float max = 0; foreach (Dust dust in plan.dusts) { addTypedDust(dust.key,dust.pos + dpos, pass, fail); if(dust.pos.z > max) max = dust.pos.z; } max += 40; zset += max; }
private void addTypedDust(bool key, Vector3 pos, DustTypes[] pass, DustTypes[] fail) { if (key && (pass.Length > 0)) { spawnDust(pass[Random.Range(0,pass.Length)],pos); } else if (!key && (fail.Length > 0)) { spawnDust(fail[Random.Range(0,fail.Length)],pos); } }
public void spawnDust(DustTypes type,Vector3 pos) { GameObject newDust = (GameObject)Instantiate(startDust, pos, Quaternion.identity); dust.Add (newDust); StarDust script = newDust.GetComponent<StarDust> (); script.Removed += new StarDust.DustRemoved (dustRemoved); script.DustType = type; script.Velocity = velocity; script.spin (); }
// events void OnTriggerEnter(Collider otherObj) { if (otherObj.gameObject.tag == "Dust") { Vector3 dist = transform.position - otherObj.attachedRigidbody.transform.position; float distMag = dist.magnitude; if (distMag > COLLISION_RADIUS) { if (heldObject == null && Time.realtimeSinceStartup - holdRequestInitateTime < HOLD_TIME_LENIENCY) { heldObject = otherObj.attachedRigidbody; } } else if (heldObject != otherObj.attachedRigidbody) { this.type = otherObj.gameObject.GetComponent<StarDust>().DustType; this.GetComponent<MeshFilter>().mesh = otherObj.gameObject.GetComponent<StarDust>().findMesh(type); Destroy (otherObj.gameObject); } } else if (otherObj.gameObject.tag == "PassWall") { if (type != otherObj.GetComponent<PassWall>().type && !lockLife) { lockLife = true; life--; myo.GetComponent<ThalmicMyo>().Vibrate (VibrationType.Short); if (life <= 0) { if ((GameObject.Find("Player1").GetComponent<Ship>().Life <= 0)) { if (opposingShip.GetComponent<Ship>().Life <= 0) { GameObject.Find("Spawner").GetComponent<UIDriver>().showStateText("Just... Wow.\nPunch The Screen\nTo Play Again"); } else { GameObject.Find("Spawner").GetComponent<UIDriver>().showStateText("Player 1 Has Died\nPunch The Screen\nTo Play Again"); } } else { if (opposingShip.GetComponent<Ship>().Life <= 0) { GameObject.Find("Spawner").GetComponent<UIDriver>().showStateText("Both Of You Suck.\nPunch The Screen\nTo Play Again"); } else { GameObject.Find("Spawner").GetComponent<UIDriver>().showStateText("Player 2 Has Died\nPunch The Screen\nTo Play Again"); } } GameObject.Find("Spawner").GetComponent<UIDriver>().showHUD(false); } else { GameObject.Find("Spawner").GetComponent<UIDriver>().showHUD(true); } } } }
public void setType(DustTypes type) { this.type = type; }
public void Setup(DustTypes dustType, float velocity) { type = dustType; this.velocity = velocity; }
private void updatePassWall(GameObject obj) { if (obj.GetComponent<Nemesis>().passWalls.Count > 0) { prevPassWall = obj.GetComponent<Nemesis>().passWalls[0].GetComponent<PassWall>().type; showGateWarning(true); } else { showGateWarning(false); } }
public BoundLiteralExpression(object value) { Value = DustTypes.FromNative(value); }