//this is the constructor for the Train class. public static Vehicle create(GameControl controller, MapSpace startSpace) { GameObject go = Instantiate (prefab, startSpace.transform.position + Vehicle.offset, Quaternion.identity) as GameObject; Train T = go.AddComponent<Train> (); T.myOrigin = startSpace; T.myLocation = startSpace; T.myDestination = startSpace; T.myControl = controller; T.myMaxCargo = 200; T.turnsUntilMove = 1; T.myMoveRate = 2; Color temp = Color.green; temp.a = 0.5f; go.GetComponent<Renderer> ().material.color = temp; go.GetComponent<ParticleSystem> ().startColor = Color.green; startSpace.addLocal (T); startSpace.addComing (T); return T; }
//this is the constructor for the Airplane class. public static Vehicle create(GameControl controller, MapSpace startSpace) { GameObject go = Instantiate (prefab, startSpace.transform.position + Airplane.offset, Quaternion.identity) as GameObject; Airplane A = go.AddComponent<Airplane> (); A.myOrigin = startSpace; A.myLocation = startSpace; A.myDestination = startSpace; A.myControl = controller; A.myMaxCargo = 90; A.turnsUntilMove = 1; A.myMoveRate = 1; Color temp = Color.red; temp.a = 0.5f; go.GetComponent<Renderer> ().material.color = temp; go.GetComponent<ParticleSystem> ().startColor = Color.red; startSpace.addLocal (A); startSpace.addComing (A); return A; }
//this is the constructor for the Boat class. public static Vehicle create(GameControl controller, MapSpace startSpace) { GameObject go = Instantiate (prefab, startSpace.transform.position + Vehicle.offset, Quaternion.identity) as GameObject; Boat B = go.AddComponent<Boat> (); B.myOrigin = startSpace; B.myLocation = startSpace; B.myDestination = startSpace; B.myControl = controller; B.myMaxCargo = 550; B.turnsUntilMove = 1; B.myMoveRate = 3; Color temp = Color.blue; temp.a = 0.5f; go.GetComponent<Renderer> ().material.color = temp; go.GetComponent<ParticleSystem> ().startColor = Color.blue; startSpace.addLocal (B); startSpace.addComing (B); return B; }