コード例 #1
0
    public override void GenerateWarpstones(Warp warp)
    {
        int direction  = Random.value < 0.5f ? 1 : -1;
        int startIndex = Random.Range(0, warp.warpSegmentCount);

        WarpSettings.WarpStoneMode spiralMode = Random.Range(0, 2) == 0 ? WarpSettings.WarpStoneMode.TetraHedron : WarpSettings.WarpStoneMode.WarpBlock;

        for (int i = 0; i < warp.CurveSegmentCount; i += 2)
        {
            int warpStoneFactor = Random.Range(1, 2);

            WarpStone wStone = Instantiate <WarpStone>(warpStonePrefab);
            wStone.warpSettings = new WarpSettings(
                startIndex,
                i,
                warp.warpRadius,
                warp.warpSegmentCount,
                warp.ringDistance,
                warp.CurveRadius,
                warp.CurveSegmentCount,
                warp.RelativeRotation,
                warpStoneFactor,
                spiralMode,
                false);
            wStone.transform.SetParent(warp.transform, false);
            wStone.Generate();

            int numberOfWarpstones = Random.Range(1, warp.maxNumberOfWarpStones);

            for (int n = 0; n < numberOfWarpstones; n++)
            {
                int nstartIndex = Random.Range(0, warp.warpSegmentCount);
                wStone = Instantiate <WarpStone>(warpStonePrefab);
                wStone.warpSettings = new WarpSettings(
                    nstartIndex,
                    i,
                    warp.warpRadius,
                    warp.warpSegmentCount,
                    warp.ringDistance,
                    warp.CurveRadius,
                    warp.CurveSegmentCount,
                    warp.RelativeRotation,
                    1,
                    WarpSettings.WarpStoneMode.TetraHedron,
                    false);
                wStone.transform.SetParent(warp.transform, false);
                wStone.Generate();
            }

            i          += warp.warpStoneDistance;
            startIndex += warpStoneFactor * direction;
        }
    }
コード例 #2
0
ファイル: BlockGenerator.cs プロジェクト: naowin/WarpZone
    public override void GenerateWarpstones(Warp warp)
    {
        int direction    = Random.value < 0.5f ? 1 : -1;
        int startIndex   = Random.Range(0, warp.warpSegmentCount);
        int warpDistance = warp.warpStoneDistance;

        for (int i = 0; i < warp.CurveSegmentCount; i += 2)
        {
            int warpStoneFactor = Random.Range(1, 3);
            if (warp.warpSegmentCount < 20)
            {
                warpStoneFactor = 1;
            }

            WarpStone wStone = Instantiate <WarpStone>(warpStonePrefab);
            wStone.warpSettings = new WarpSettings(
                startIndex,
                i,
                warp.warpRadius,
                warp.warpSegmentCount,
                warp.ringDistance,
                warp.CurveRadius,
                warp.CurveSegmentCount,
                warp.RelativeRotation,
                warpStoneFactor,
                WarpSettings.WarpStoneMode.WarpBlock,
                false);
            wStone.transform.SetParent(warp.transform, false);
            wStone.Generate();

            i          += warp.warpStoneDistance;
            startIndex += warpStoneFactor * direction;
        }
    }
コード例 #3
0
    public override void GenerateWarpstones(Warp warp)
    {
        for (int i = 0; i < warp.CurveSegmentCount; i++)
        {
            int[] indexes            = new int[warp.warpSegmentCount];
            int   numberOfWarpstones = Random.Range(1, 4);
            int   depthFactor        = 0;
            for (int n = 0; n < numberOfWarpstones; n++)
            {
                int startIndex = Random.Range(0, warp.warpSegmentCount);
                while (indexes[startIndex] > 0)
                {
                    startIndex = Random.Range(0, warp.warpSegmentCount);
                }

                indexes[startIndex] = 1;
                int warpStoneFactor = Random.Range(1, 3);
                if (warpStoneFactor > depthFactor)
                {
                    depthFactor = warpStoneFactor;
                }

                WarpStone wStone = Instantiate <WarpStone>(warpStonePrefab);
                wStone.warpSettings = new WarpSettings(
                    startIndex,
                    i,
                    warp.warpRadius,
                    warp.warpSegmentCount,
                    warp.ringDistance,
                    warp.CurveRadius,
                    warp.CurveSegmentCount,
                    warp.RelativeRotation,
                    warpStoneFactor,
                    warpstone[Random.Range(0, 6)],
                    false);
                wStone.transform.SetParent(warp.transform, false);
                wStone.Generate();
            }

            i += depthFactor;
        }
    }
コード例 #4
0
ファイル: PyramidGenerator.cs プロジェクト: naowin/WarpZone
    public override void GenerateWarpstones(Warp warp)
    {
        for (int i = 0; i < warp.CurveSegmentCount; i++)
        {
            int[] indexes = new int[warp.warpSegmentCount];

            int numberOfWarpstones = Random.Range(1, warp.maxNumberOfWarpStones);
            for (int n = 0; n < numberOfWarpstones; n++)
            {
                int startIndex = Random.Range(0, warp.warpSegmentCount);
                while (indexes[startIndex] > 0)
                {
                    startIndex = Random.Range(0, warp.warpSegmentCount);
                }

                indexes[startIndex] = 1;
                int warpStoneFactor = warpStoneFactors[Random.Range(0, 5)];
                if (warp.warpSegmentCount < 20)
                {
                    warpStoneFactor = 1;
                }

                WarpStone wStone = Instantiate <WarpStone>(warpStonePrefab);
                wStone.warpSettings = new WarpSettings(
                    startIndex,
                    i,
                    warp.warpRadius,
                    warp.warpSegmentCount,
                    warp.ringDistance,
                    warp.CurveRadius,
                    warp.CurveSegmentCount,
                    warp.RelativeRotation,
                    warpStoneFactor,
                    WarpSettings.WarpStoneMode.TetraHedron,
                    false);
                wStone.transform.SetParent(warp.transform, false);
                wStone.Generate();
            }

            i += warp.warpStoneDistance;
        }
    }