Пример #1
0
    void getFloorTypeByChallengeManager()
    {
        floorTypeData = ChallengeManager.current.refreshFloorType();

        /*FloorTypeData data = ChallengeManager.current.refreshFloorType();
         * remainingFloorCount =   data.floorCount;
         * coinCount = data.coinCount;
         * coinRemain = Random.Range(coinCount, remainingFloorCount);
         * floorTurningAngle = data.floorTurningAngle;
         * obstacleCount = data.obstacleCount;
         * obstacleCountRemain = Random.Range(obstacleCount, remainingFloorCount);*/
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        current = this;

        GameManager.current.state = GameManager.GameState.AssembleTrack;

        floorMeshes = new FloorMesh[floorMeshCount];
        for (int a = 0; a != floorMeshCount; ++a)
        {
            GameObject floorObject = (GameObject)Instantiate <GameObject>(floorMeshPrefab);
            floorObject.transform.position = Vector3.zero;
            floorMeshes[a]               = floorObject.GetComponent <FloorMesh>();
            floorMeshes[a].width         = width;
            floorMeshes[a].length        = length;
            floorMeshes[a].index         = a;
            floorMeshes[a].coinIndex     = -1;
            floorObject.transform.parent = transform;
        }
        floorTypeData                   = new FloorTypeData();
        floorTypeData.floorCount        = initialStraightLength;
        floorTypeData.floorTurningAngle = 0;
        obstacleCount                   = 0;
        obstacleCountRemain             = 0;

        floorMeshes[0].prevPos1 = new Vector3(0, 0, 0);
        floorMeshes[0].prevPos2 = new Vector3(5, 0, 0);
        floorMeshes[0].dir      = (new Vector3(0, -0.05f, 0.9f)).normalized;
        floorMeshes[0].prevDir  = Vector3.forward;
        floorMeshes[0].makeMesh();

        startIndex = 1;
        endIndex   = 0;
        for (int a = 1; a != floorMeshCount; ++a)
        {
            /*remainingFloorCount--;
             * if (remainingFloorCount <= 0)
             *  getFloorTypeByChallengeManager();//refreshFloorType();
             * floorMeshes[a].prevDir = floorMeshes[a - 1].dir;
             * floorMeshes[a].dir = Quaternion.Euler(0, floorTurningAngle, 0) * floorMeshes[a].prevDir;
             * floorMeshes[a].prevPos1 = floorMeshes[a - 1].endPos1;
             * floorMeshes[a].prevPos2 = floorMeshes[a - 1].endPos2;
             * floorMeshes[a].makeMesh();
             *
             * coinRemain--;
             * if(coinRemain>=0 && coinRemain < coinCount)
             *  CoinGenerator.current.putCoin(a);*/
            makeFloorByType();
        }
    }