Example #1
0
    public override void OnInspectorGUI()
    {
        RoadGenerator generator = (RoadGenerator)target;

        // Show default inspector property editor
        DrawDefaultInspector();

        if (GUILayout.Button("Generate"))
        {
            generator.Regenerate();
        }
    }
Example #2
0
    void Start()
    {
        AudioListener.volume = AudioVolume;
        GameTime.Instance.m_timeMultiplier = PlaybackSpeed;

        m_trafficController = FindObjectOfType <TrafficController>();
        m_roadGenerator     = FindObjectOfType <RoadGenerator>();
        m_controller        = FindObjectOfType <SplineFollowControl>();
        m_uiController      = FindObjectOfType <UIController>();

        m_roadGenerator.Regenerate();

        m_trafficController.Begin();
        m_controller.ControlBegin();

        // Spawn riders
        for (int riderIndex = 0; riderIndex < NumRiders; ++riderIndex)
        {
            Rider newRider = Instantiate(RiderPrefab.gameObject).GetComponent <Rider>();
            newRider.TeamId = 0;
            newRider.RiderStart();
            m_riders.Add(newRider);
            m_trafficController.RegisterFocalObject(newRider.gameObject);

            m_uiController.RegisterPlayerRider(newRider, false);
        }

        for (int riderIndex = 0; riderIndex < NumEnemyRiders; ++riderIndex)
        {
            Rider newRider = Instantiate(EnemyRiderPrefab.gameObject).GetComponent <Rider>();
            newRider.TeamId = 1;
            newRider.RiderStart();
            m_enemyRiders.Add(newRider);
            m_trafficController.RegisterFocalObject(newRider.gameObject);

            m_uiController.RegisterPlayerRider(newRider, true);
        }
    }