// Start is called before the first frame update
    void Start()
    {
        gameManager = FindObjectOfType <GameManager>();
        if (gameManager == null)
        {
            throw new System.Exception($"Unable to find object of type {nameof(GameManager)}");
        }

        vehicleRenderController = FindObjectOfType <VehicleRenderController>();
        if (vehicleRenderController == null)
        {
            throw new System.Exception($"Unable to find object of type {nameof(VehicleRenderController)}");
        }

        vehiclePhysicsController = FindObjectOfType <VehiclePhysicsController>();
        if (vehiclePhysicsController == null)
        {
            throw new System.Exception($"Unable to find object of type {nameof(VehiclePhysicsController)}");
        }

        resourceManager = FindObjectOfType <ResourceManager>();
        if (resourceManager == null)
        {
            throw new System.Exception($"Unable to find object of type {nameof(ResourceManager)}");
        }

        keyComboPrompt = FindObjectOfType <KeyComboPrompt>();
        if (keyComboPrompt == null)
        {
            throw new System.Exception($"Unable to find object of type {nameof(KeyComboPrompt)}");
        }

        keyComboPrompt.Hide();
    }
    void Start()
    {
        vehicleRenderController = FindObjectOfType <VehicleRenderController>();
        if (vehicleRenderController == null)
        {
            throw new System.Exception($"Unable to find object of type {nameof(VehicleRenderController)}");
        }

        vehicleRigidbody = GetComponentInParent <Rigidbody>();
        if (vehicleRigidbody == null)
        {
            throw new System.Exception($"Unable to get component in parent of type {nameof(Rigidbody)}");
        }

        // Increase stability
        vehicleRigidbody.centerOfMass = centerOfMass;
        vehicleRigidbody.constraints  = RigidbodyConstraints.FreezePositionX | RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezeRotationZ;
    }
Beispiel #3
0
    // Start is called before the first frame update
    void Start()
    {
        gameManager = FindObjectOfType <GameManager>();
        if (gameManager == null)
        {
            throw new System.Exception($"Unable to find object of type {nameof(GameManager)}");
        }

        vehicleRenderController = FindObjectOfType <VehicleRenderController>();
        if (vehicleRenderController == null)
        {
            throw new System.Exception($"Unable to find object of type {nameof(VehicleRenderController)}");
        }

        vehiclePhysicsController = FindObjectOfType <VehiclePhysicsController>();
        if (vehiclePhysicsController == null)
        {
            throw new System.Exception($"Unable to find object of type {nameof(VehiclePhysicsController)}");
        }

        gameManager.SetMaxFuel(maxFuel);
        gameManager.SetCurrentFuel(maxFuel);
    }