コード例 #1
0
    /*void Update()
     * {
     * }*/

    void Start()
    {
//		Destroy (GameObject.Find ( "Main Camera Menu"));

        arrowManager = GetComponentInChildren <ArrowManager>();
        endUIScript  = GetComponentInChildren <EndUIScript>();
        timerScript  = GetComponentInChildren <TimerManager>();
        soundScript  = GetComponent <SoundScript>();

        HorsePowerApplied = horsePower;
        GetComponent <Rigidbody>().centerOfMass = Vector3.down * 1.5f;
        currentSpeed = 0.0f;

        //Compute the vertical and horizontal distance between the wheels in order to make some trigonometry for
        //wheels steer angles
        dv = Mathf.Abs(WheelLF.transform.position.x - WheelRB.transform.position.x);
        dh = Mathf.Abs(WheelLF.transform.position.z - WheelRB.transform.position.z);
        //Save the base position of both axle in order to modifiy it according to the suspension
        offsetAxleB = AxleBack.localPosition;
        offsetAxleF = AxleFront.localPosition;

        GameObject respawn = (GameObject)GameObject.FindGameObjectsWithTag("Respawn").GetValue(0);

        transform.position = respawn.transform.position;
        transform.rotation = respawn.transform.rotation;
        GetComponent <Rigidbody>().angularVelocity = Vector3.zero;

        timerScript.LaunchTimer();
        endUIScript.ResetTime();
    }
コード例 #2
0
ファイル: VehicleManager.cs プロジェクト: ice-blaze/msr
    void Start()
    {
        arrowManager = GetComponentInChildren <ArrowManager>();
        endUIScript  = GetComponentInChildren <EndUIScript>();
        timerScript  = GetComponentInChildren <TimerManager>();
        vehicleMove  = GetComponentInChildren <VehicleMove>();
        soundScript  = GetComponent <SoundScript>();

        GameObject respawn = (GameObject)GameObject.FindGameObjectsWithTag("Respawn").GetValue(0);

        transform.position = respawn.transform.position;
        transform.rotation = respawn.transform.rotation;

        timerScript.LaunchTimer();
        endUIScript.ResetTime();
    }