Ejemplo n.º 1
0
        private void Update()
        {
            get = this;


            if (CurvedWorld_Controller.current)
            {
                if (Input.GetKey(KeyCode.LeftArrow))
                {
                    CurvedWorld_Controller.current.leftRightSize = Mathf.Clamp(CurvedWorld_Controller.current.leftRightSize + Time.deltaTime * 20, -7, 7);
                }
                else if (Input.GetKey(KeyCode.RightArrow))
                {
                    CurvedWorld_Controller.current.leftRightSize = Mathf.Clamp(CurvedWorld_Controller.current.leftRightSize - Time.deltaTime * 20, -7, 7);
                }
                else if (Input.GetKey(KeyCode.UpArrow))
                {
                    CurvedWorld_Controller.current.upDownSize = Mathf.Clamp(CurvedWorld_Controller.current.upDownSize + Time.deltaTime * 20, -7, 7);
                }
                else if (Input.GetKey(KeyCode.DownArrow))
                {
                    CurvedWorld_Controller.current.upDownSize = Mathf.Clamp(CurvedWorld_Controller.current.upDownSize - Time.deltaTime * 20, -7, 7);
                }
            }
        }
Ejemplo n.º 2
0
        //////////////////////////////////////////////////////////////////////////////
        //                                                                          //
        //Unity Functions                                                           //
        //                                                                          //
        //////////////////////////////////////////////////////////////////////////////
        void Awake()
        {
            get = this;


            //Instantiate chunks
            for (int i = 0; i < chunks.Length; i++)
            {
                GameObject obj = (GameObject)Instantiate(chunks[i]);

                obj.transform.position = new Vector3(0, 0, i * chunkSize);

                lastChunk = obj;
            }

            //Instantiate cars
            for (int i = 0; i < cars.Length; i++)
            {
                Instantiate(cars[i]);
            }
        }