Version 4 (modified by edy, 13 years ago) (diff) |
---|
CarMain
Main script for controlling the scene. The controllable vehicles and the logic of the scene are managed here.
- Reads, manages and applies all user input (keyboard, joystick, etc).
- Allows vehicle selection and driving.
- Controls the camera modes.
- Configures the camera and shadows for quality modes (F12).
- Shows the vehicle's dashboard (speed, driving aids, etc).
- Shows the help window (H).
- Shows the vehicle's telemetry window (B) if a CarTelemetry script is available in the same GameObject.
- Offers the slow time feature.
This script is added to a Main GameObject intended to hold the control scripts for the scene.
Cars: references to the controllable vehicles in the scene. They must contain a CarControl script. User can switch the active car with the PageUp / PageDown keys.
startupCar: car of the list that will be selected on startup.
MainCamera: reference to the main camera of the scene. It must contain a CameraControl script.
MainLight: reference to the main light of the scene. The script configures its shadows for offering the low quality mode (F12).
reverseRequiresStop: Configures the stop and reverse behavior. If enabled, car is required to completely stop, then releasing and pressing the brake key again in order to go reverse.
PayLoad: reference to the object used as payload (the gray box in the live demo, key E for moving. It's just for fun in the demo).
slowTime: time scale used for the slow time mode (T).
showHelp: help window enabled or disabled (H).
guiEnabled: vehicle's dashboard enabled or disabled.
BigTextStyle, TextStyle, BoxStyle, guiSkin: GUIStyle and GUISkin objects for displaying the dashboard.