Exemple #1
0
    // Use this for initialization
    void Start()
    {
        _canvas    = GameObject.Find("BuilderGUICanvas(Clone)");
        BuilderCam = GameObject.Find("BuilderCamera").GetComponent <Camera>();
        Toolbox    = _canvas.GetComponent <ToolboxController>();
        Toolbox.ToolOptionChanged += ToolChange;
        Bez = BezierLine.Instance;
        Rd  = Road.Instance;
        if (Road.Instance.Segments.Count == 0 || Road.Instance.Segments[0].goSeg == null)    //Cos When they might already be built
        {
            if (Road.Instance.StartingLinePos != null)
            {
                PlaceStartingLine(Road.Instance.StartingLineSegIdx);
            }
        }
        Bez.CreateGameObject();
        Bez.DrawLine();
        if (GameData.current.MacId == SystemInfo.deviceUniqueIdentifier)
        {
            Bez.CreateRoadMarkers();
        }
        //Open the tutorial if building first track
        if (SaveLoadModel.savedGames.Count < 3)     //!!!!!change to 3
        {
            UnityEngine.Object objPnl1 = Resources.Load("Prefabs/pnlTutorialBuild1");
            GameObject         goVid   = (GameObject)(GameObject.Instantiate(objPnl1, _canvas.transform));
            goVid.transform.localScale = Vector3.one;
            goVid.GetComponent <RectTransform>().anchoredPosition = Vector2.zero;
        }

        //Open the turorial panel so you can say how many cones left
        UnityEngine.Object objPnl = Resources.Load("Prefabs/pnlTutorialBuild2");
        GameObject         goTut  = (GameObject)(GameObject.Instantiate(objPnl, _canvas.transform));

        Tut = goTut.GetComponent <Tutorial>();
        Tut.transform.localScale = Vector3.one;
        Tut.GetComponent <RectTransform>().anchoredPosition = Vector2.zero;
        Tut.gameObject.SetActive(false);
    }