Example #1
0
    override protected void SteeringUpdate()
    {
        if (Input.GetButtonDown("ChangeVehicle"))
        {
            if (specs.actualVehicle != specs.mainVehicle)
            {
                specs.OutofVehicle();
                specs.IntoVehicle(specs.mainVehicle);
            }
            else
            {
                RaycastHit hit;
                if (Physics.Raycast(transform.position, transform.forward, out hit, 10f, mask))
                {
                    specs.OutofVehicle();
                    specs.IntoVehicle(hit.collider.gameObject.transform.parent.GetComponent <VehicleTypeDefiner>());
                }
                else
                {
                    if (specs.inTrigger.Count > 0)
                    {
                        specs.OutofVehicle();
                        specs.IntoVehicle(specs.inTrigger[0]);
                    }
                }
            }
        }

        if (specs.actualVehicle != null)
        {
            switch (specs.actualVehicle.vehicleType)
            {
            case VehicleType.Drone:
                steeringDrone.Steer(Input.GetAxis("Thrust"), Input.GetAxis("Pitch"), Input.GetAxis("Roll"), Input.GetAxis("Yaw"), Input.GetAxis("PrototypeTurbo"),
                                    Input.GetButtonDown("Lights"), Input.GetButtonDown("Turn off motors"), Input.GetButtonDown("Stabilize"), Input.GetButtonDown("Keep altitude"),
                                    Input.GetButtonDown("Self leveling"));
                break;

            case VehicleType.Tractor:
                tractorScriptEasy.Steer(Input.GetButtonDown("Break"), Input.GetButtonUp("Break"), Input.GetAxis("Vertical"), Input.GetAxis("Horizontal"),
                                        Input.GetButtonDown("Gear Down"), Input.GetButtonDown("Gear Up"));
                trailerTrolley.Steer(Input.GetAxis("Trolley"));
                break;

            case VehicleType.Robot:
                robotWheelsSteering.Steer(Input.GetAxis("Vertical"), Input.GetAxis("Horizontal"), Input.GetAxis("Spread(robot)"),
                                          Input.GetAxis("Height(robot)"), Input.GetButtonDown("Turning in place"));
                robotGrabber.Steer(Input.GetButtonUp("Item outside"), Input.GetButtonUp("Item inside"), Input.GetButton("Item outside"),
                                   Input.GetButton("Item inside"), Input.GetButtonDown("Next Item"), Input.GetButtonDown("Previous Item"), Input.GetButtonDown("Hands Up"));
                break;
            }
        }
        if (specs.weaponManager)
        {
            foreach (Shooter weapon in specs.weaponManager.weapons_Shooter)
            {
                weapon.shoot = Input.GetButton("Fire");
            }
        }
    }
Example #2
0
        private void Update()
        {
            if (Input.GetAxis("Jump") > 0 && Grounded)
            {
                jump = true;
            }

            physics.AddRelativeTorque(0, Torque * Input2.GetAxis("Frame Yaw"), 0);
        }