Exemplo n.º 1
0
    public void Reload(UnityEngine.UI.Dropdown option)
    {
        if (option.value < mapArray.Length)
        {
            MapConstruction component = mapArray[option.value].GetComponent <MapConstruction>();
            if (component)
            {
                Car __car = carRef.GetComponent <Car>();
                if (__car)
                {
                    Rigidbody __body = __car.GetComponent <Rigidbody>();
                    if (__body)
                    {
                        __body.velocity = Vector3.zero;
                    }

                    map.gameObject.SetActive(false);
                    component.gameObject.SetActive(true);

                    map = component;
                    SetUpCarsapwn();

                    __car.Initialize(GetCurveArray);
                }
            }
        }
    }
Exemplo n.º 2
0
    private void Awake()
    {
        Instance = this;
        if (!this.map.gameObject.activeSelf || this.map == null)
        {
            var __mapsOnScene = FindObjectsOfType <MapConstruction>();
            foreach (var __currentMap in __mapsOnScene)
            {
                if (__currentMap.gameObject.activeSelf)
                {
                    map = __currentMap;
                    break;
                }
            }
        }

        SetUpCarsapwn();
    }
Exemplo n.º 3
0
    public void Build()
    {
        if (_mConfig)
        {
            GameObject __root = new GameObject("Instance_Map");
            __root.transform.position = _mConfig.Positions[0];


            MapConstruction Map = __root.AddComponent <MapConstruction>();
            for (int i = 0; i < _mConfig.Size; i++)
            {
                GameObject spawn = _prefabs[_mConfig.Tiles[i] - 1];
                spawn = (GameObject)Instantiate(spawn, _mConfig._positions[i], _mConfig._rotations[i], __root.transform);

                if (_mConfig.Tiles[i] == (int)MapMakerIII.Blocks.Curve)
                {
                    Map.AddCurve(spawn);
                }

                _tiles.Add(spawn);
            }
        }
    }