当前位置: 首页>>代码示例>>C#>>正文


C# GameControl.GetGameMapSeed方法代码示例

本文整理汇总了C#中GameControl.GetGameMapSeed方法的典型用法代码示例。如果您正苦于以下问题:C# GameControl.GetGameMapSeed方法的具体用法?C# GameControl.GetGameMapSeed怎么用?C# GameControl.GetGameMapSeed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GameControl的用法示例。


在下文中一共展示了GameControl.GetGameMapSeed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

    void Start()
    {
        LoadLocationNames();
        background = GameObject.Find ("MapScreenBackground");
        if (!background) Debug.Log("Can't find map background");
        InputRepeater repeater = background.AddComponent<InputRepeater>();
        repeater.SetTarget(transform);

        GameObject cameraControlObj = GameObject.Find ("CameraPivot");
        cameraControl = cameraControlObj.GetComponent<MapCameraControl>();
        cameraControl.SetUp(this);
        if (!cameraControl) Debug.Log("Can't find map camera");

        GameObject gameControlObj = GameObject.Find ("GameControl");
        gameControl = gameControlObj.GetComponent<GameControl>();
        if (!gameControl) Debug.Log("Can't find GameControl");

        Random.seed = gameControl.GetGameMapSeed();

        GameObject point = null;
        if (interval < 1) {
            Debug.Log("Inverval too low");
            return;
        }
        int zOffset = 0;
        for (int x = 0; x < width; x += interval) {
            if (zOffset == 0) {
                zOffset = 1;
            } else {
                zOffset = 0;
            }
            for (int z = zOffset; z < length; z += interval) {
                if (Random.value < density) {
                    point = Instantiate(dotPrefab, Vector3.zero, Quaternion.identity) as GameObject;
                    point.transform.name = "Point-" + x + "-" + z;
                    Vector3 randomOffset = new Vector3(Random.Range(-0.25f, 0.25f), 0, Random.Range(-0.25f, 0.25f));
                    Vector3 centerOffset = new Vector3(-(float) width * 0.5f, 0, -(float)length * 0.5f);
                    point.transform.parent = transform;
                    point.transform.localPosition = new Vector3(x, 0, z) + randomOffset + centerOffset;
                    point.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
                    points.Add(point.transform);
                }
            }
        }
        point.renderer.sharedMaterial.renderQueue = 3100;
        CreatePlayerBase();
        CreateEnemyBase();
        ConnectBases();
        SetUpConnections();
        SetSpecialNodes();

        string nextStep = gameControl.currentLevel.Equals("Menu") ? "MapIntro" : "AddResults";

        Invoke (nextStep, 2);

        portraitThief = GameObject.Find ("MapScreenThief").transform;
        portraitThief.animation.Play("Intro");
        Invoke ("playPortraitLoop", portraitThief.animation["Intro"].length);
    }
开发者ID:Diggery,项目名称:SuperSneak,代码行数:59,代码来源:MapControl.cs


注:本文中的GameControl.GetGameMapSeed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。