// Use this for initialization /// <summary> /// Find all cars, buttons and add listener /// </summary> void Start() { nextSceneManager = GameObject.Find("NextSceneManager").GetComponent <NextSceneManager>(); playerCar = GameObject.Find("PlayerCar").GetComponent <PlayerCar>(); xCar1 = GameObject.Find("X-Car1").GetComponent <XCar>(); xCar2 = GameObject.Find("X-Car2").GetComponent <XCar>(); xCar3 = GameObject.Find("X-Car3").GetComponent <XCar>(); xCar4 = GameObject.Find("X-Car4").GetComponent <XCar>(); xCar5 = GameObject.Find("X-Car5").GetComponent <XCar>(); xCar6 = GameObject.Find("X-Car6").GetComponent <XCar>(); yCar1 = GameObject.Find("Y-Car1").GetComponent <YCar>(); yCar2 = GameObject.Find("Y-Car2").GetComponent <YCar>(); yCar3 = GameObject.Find("Y-Car3").GetComponent <YCar>(); yCar4 = GameObject.Find("Y-Car4").GetComponent <YCar>(); yCar5 = GameObject.Find("Y-Car5").GetComponent <YCar>(); yCar6 = GameObject.Find("Y-Car6").GetComponent <YCar>(); right = GameObject.Find("ButtonRight").GetComponent <Button>(); left = GameObject.Find("ButtonLeft").GetComponent <Button>(); up = GameObject.Find("ButtonUp").GetComponent <Button>(); down = GameObject.Find("ButtonDown").GetComponent <Button>(); textArea = GameObject.Find("TextField").GetComponent <Text>(); reset = GameObject.Find("ButtonReset/Continue").GetComponent <Button>(); reset.onClick.AddListener(ResetGame); buttonText = GameObject.Find("ButtonReset/Continue").GetComponentInChildren <Text>(); buttonText.text = "Reset"; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { //Load engine base content X.LoadContent(); //Game base elements menus.Load(Content); // load scene objects/content //sky = new XDynamicSky(ref X,X.Environment); //XSkyBox sky = new XSkyBox(ref X, @"Content\XEngine\Textures\Sky\front", @"Content\XEngine\Textures\Sky\back", @"Content\XEngine\Textures\Sky\left", @"Content\XEngine\Textures\Sky\right", @"Content\XEngine\Textures\Sky\top", @"Content\XEngine\Textures\Sky\bottom"); XSkyBox sky = new XSkyBox(ref X, @"Content\XEngine\Textures\Sky\GreenWaterSky"); heightmap = new XHeightMap(ref X, @"Content\Images\Heightmaps\Level2", X.Environment, @"Content\Textures\Grass", @"Content\Textures\Sand", null, @"Content\Images\Terrainmaps\Island1"); //resources.AddComponent(environment); resources.AddComponent(heightmap); resources.AddComponent(sky); model = new XModel(ref X, @"Content\Models\cube"); resources.AddComponent(model); Chassis = new XModel(ref X, @"Content\Models\chassis"); Wheel = new XModel(ref X, @"Content\Models\wheel"); resources.AddComponent(Chassis); resources.AddComponent(Wheel); housemodel = new XModel(ref X, @"Content\Models\spider"); resources.AddComponent(housemodel); resources.Load(); //Car = new XCar(ref X, Chassis, Wheel, true, true, 30.0f, 5.0f, 4.7f, 5.0f, 0.20f, 0.4f, 0.05f, 0.45f, 0.3f, 1, 520.0f, Math.Abs(X.Gravity.Y), new Vector3(-10, heightmap.Heights.GetHeight(new Vector3(-10, 3, 0))+5, 0)); Car = new XCar(ref X, Chassis, Wheel, true, // front wheel drive true, // rear wheel drive 35.0f, // max steering angle 5f, // steering rate 3.6f, // front lateral traction 3.1f, // rear lateral traction 1f, // front longintudinal traction 2f, // rear longitudinal traction 2.5f, // handbrake rear lateral traction .75f, // handbrake rear longitudinal traction 6f, // starting slide factor 15f, // threshold 1 slide factor 30f, // threshold 2 slide factor .7f, // slip threshold 1 10.0f, // slip threshold 2 2.0f, // slide speed factor 1.7f, // traction loss factor on slip 0.3f, // suspension travel 0.45f, // wheel radius -0.10f, // wheel mounting point 0.6f, // spring rate 0.6f, // shock dampening 2, // wheel rays 2.5f, // roll resistance 300.0f, // top speed 1200.0f, // torque X.Physics.Gravity.Length(), // gravity new Vector3(-10, heightmap.Heights.GetHeight(new Vector3(-10, 3, 0)) + 5, 0) ); Car.Load(X.Content); trees = new XTreeSystem(ref X, @"Content\Images\Treemaps\Level1", heightmap); trees.Load(Content); trees.GenerateTrees(freeCamera); input.Load(); base.LoadContent(); }
public YCarBuilder() { Car = new XCar(); }