예제 #1
0
파일: Main.cs 프로젝트: nizsanli/tunnel
    // Update is called once per frame
    void Update()
    {
        float section = Mathf.Floor(ship.transform.position.x / 100f);

        if (section + 2 > numAdded)
        {
            Vector3 newStart = part.MidPoint;
            part = (TunnelPart)Instantiate(partPrefab, Vector3.zero, Quaternion.identity);
            part.init(newStart, generationSeed);
            parts.Add(part);
            part.transform.parent = partsContainer;
            numAdded++;
        }

        if (parts.Count > 3)
        {
            Destroy(parts[0].gameObject);
            parts.RemoveAt(0);
        }

        bool mouseEvent = false;

        if (Input.GetMouseButton(0))
        {
            mouseEvent = true;
        }

        controlShip(mouseEvent);
    }
예제 #2
0
파일: Main.cs 프로젝트: nizsanli/tunnel
    // Use this for initialization
    void Start()
    {
        Camera.main.transform.Translate(new Vector3(Camera.main.orthographicSize * Camera.main.aspect, 0f, 0f));

        parts = new List <TunnelPart>(100);

        part = (TunnelPart)Instantiate(partPrefab, Vector3.zero, Quaternion.identity);
        part.init(Vector3.zero, generationSeed);
        parts.Add(part);
        part.transform.parent = partsContainer;
        numAdded++;
    }