コード例 #1
0
 //Create a cloned object so we can access the functions
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
コード例 #2
0
    // start from unity3d
    public void Start()
    {
        GameObject mc = GameObject.Find("Motorcycle");         // get mc gameobject

        modelScript = mc.GetComponent <modelController>();     // get the model controller script attached

        init();
    }
コード例 #3
0
    // Update is called once per frame in Unity
    void Update()
    {
        GameObject mc = GameObject.Find("Motorcycle");               // get mc gameobject

        modelControllerScript = mc.GetComponent <modelController>(); // mc script
        //create message with parameters from mc model state
        UnityMsg msg = new UnityMsg(modelControllerScript.isRunning, modelControllerScript.isOffroad, modelControllerScript.crash, modelControllerScript.incline, modelControllerScript.leaning);

        ros.Publish(publishUnityTopic.GetMessageTopic(), msg);

        ros.Render();
    }
コード例 #4
0
    [SerializeField] private AudioClip menuMusic;                      // The clip to play when the bar finishes filling.


    // Use this for initialization
    void Start()
    {
        musicAudio.clip = menuMusic;
        musicAudio.loop = true;
        musicAudio.Play();
        GameObject mc = GameObject.Find("Motorcycle");               // get mc gameobject

        modelControllerScript = mc.GetComponent <modelController>(); // mc script
        modelControllerScript.setSpotlight(daylight);

        raceMap     = GameObject.Find("raceTrackLakeLevel");
        speedwayMap = GameObject.Find("DG MotorSpeedWay");

        initMap();
    }
コード例 #5
0
    // Use this for initialization
    void Start()
    {
        GameObject VRHeadset = GameObject.Find("MainCamera");          // get VR headset gameobject

        //Transform VrOrigin = VRHeadset.transform; // get starting origin
        VRPosition = VRHeadset.transform;

        GameObject mc = GameObject.Find("Motorcycle");               // get mc gameobject

        modelControllerScript = mc.GetComponent <modelController>(); // mc script

        // save original positions
        body_origin_x = avatar_body.localEulerAngles.x;
        body_origin_z = avatar_body.localEulerAngles.z;
    }
コード例 #6
0
    private float brake_timeout    = 3f; // seconds
    // Use this for initialization
    void Start()
    {
        GameObject mc = GameObject.Find("Motorcycle");                 // get mc gameobject

        modelControllerScript = mc.GetComponent <modelController>();   // mc script

        //gearRatio = new int[] { 900, 1880, 3400, 5800, 8850, 10000, 13000 };
        //AudioSource = GetComponent<AudioSource>();
        AudioSource[] audios = GetComponents <AudioSource>();

        //Grab audioclip from sources, same numbering as the unity order!
        RPM4000   = audios[0];
        shiftUp   = audios[1];
        ignition  = audios[2];
        shiftDown = audios[3];
        brake     = audios[6];

        gear    = 0;             //Neutral gear
        oldGear = gear;
    }
コード例 #7
0
ファイル: main.cs プロジェクト: GitTibbe/Mc-Simulator-with-VR
    [SerializeField] private AudioClip menuMusic;                      // The clip to play when the bar finishes filling.


    // Use this for initialization
    void Start()
    {
        musicAudio.clip = menuMusic;
        musicAudio.loop = true;
        musicAudio.Play();
        GameObject mc = GameObject.Find("Motorcycle");               // get mc gameobject

        modelControllerScript = mc.GetComponent <modelController>(); // mc script
        modelControllerScript.setSpotlight(daylight);

        raceMap     = GameObject.Find("raceTrackLakeLevel");
        speedwayMap = GameObject.Find("DG MotorSpeedWay");

        initMap();
        if (PlayerPrefs.GetFloat("Score") == 0)                   // first play
        {
            PlayerPrefs.SetFloat("Score", (float)Mathf.Infinity); // reset best score
        }
        if (PlayerPrefs.GetString("Name") == "")                  // first player
        {
            PlayerPrefs.SetString("Name", "Unknown Player");
        }
    }
コード例 #8
0
    modelController modelControllerScript;     // mc model
    // Use this for initialization
    void Start()
    {
        GameObject mc = GameObject.Find("Motorcycle");               // get mc gameobject

        modelControllerScript = mc.GetComponent <modelController>(); // mc script
    }