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


C# Scene.Init方法代码示例

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


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

示例1: StartTest

        void StartTest()
        {
            GameObject sceneRoot = new GameObject("SceneRoot");
            scene = sceneRoot.AddComponent<Scene>();
            scene.Init();
            scene.Load("Settings/test_game_s.map");

            SpawnWaveSetting spawnWaveSetting = new SpawnWaveSetting();
            spawnWaveSetting.WaveIndex = 0;
            spawnWaveSetting.IntervalTime = 1;
            spawnWaveSetting.SpawnTimes = int.MaxValue;
            spawnWaveSetting.SpawnPerTime = 1;
            spawnWaveSetting.TemplateID = 0;
            SpawnLocationSetting spawnLocationSetting = new SpawnLocationSetting();
            spawnLocationSetting.PathIndex = 0;
            spawnLocationSetting.Waves = new SpawnWaveSetting[] { spawnWaveSetting };
            SpawnSetting spawnSetting = new SpawnSetting();
            spawnSetting.Locations = new SpawnLocationSetting[] { spawnLocationSetting };
            scene.SpawnManager.Load(spawnSetting);

            SceneManager.Init();
            SceneManager.Instance.SwitchTo(scene);
            scene.StartScene();
            scene.SpawnManager.Start();

            Player.Me.SelectedTowers.Add(0);
            Player.Me.SelectedTowers.Add(1);

            UIManager.Instance.CreateUI<SceneEventUI>(UILayer.LayerLow);
        }
开发者ID:kidsang,项目名称:ProjectJ,代码行数:30,代码来源:TestGame.cs

示例2: StartTest

        void StartTest()
        {
            GameObject sceneRoot = new GameObject("SceneRoot");
            scene = sceneRoot.AddComponent<Scene>();
            scene.Init();
            scene.Load("Settings/test.map");
            scene.StartScene();

            SceneManager.Init();
            SceneManager.Instance.SwitchTo(scene);

            float mapWidth = scene.Map.Width;
            float mapHeight = scene.Map.Height;
            for (int i = 0; i < 100; ++i)
            {
                MonsterEntity monsterEntity = scene.CreateMonsterEntity(0);
                scene.AddEntityToScene(monsterEntity, new Vector3(Random.value * mapWidth, Random.value * mapHeight, 0));
            }

            tower = scene.CreateTowerEntity(0);
            tower.ShowDebugDraw = true;
            scene.AddEntityToScene(tower, new Vector3(mapWidth / 2, mapHeight / 2, 0));

            towerAtk = tower.AttrComp.AtkBase;
            towerAtkSpeed = tower.AttrComp.AtkSpeedBase;
            towerAtkRange = tower.AttrComp.AtkRangeBase;
        }
开发者ID:kidsang,项目名称:ProjectJ,代码行数:27,代码来源:TestAttack.cs

示例3: SwitchTo

        public void SwitchTo()
        {
            if (Scene != null)
                Scene.Dispose();

            GameObject sceneRoot = new GameObject("SceneRoot");
            Scene = sceneRoot.AddComponent<Scene>();
            Scene.Init();

            // TODO:
            Scene.Load("Settings/test.map");
            Scene.StartScene();

            Camera camera = Camera.main;
            float cameraHalfHeight = camera.orthographicSize;
            float cameraHalfWidth = cameraHalfHeight * camera.aspect;
            float left = cameraHalfWidth;
            float right = Scene.Map.Width - cameraHalfWidth;
            float bottom = cameraHalfHeight;
            float top = Scene.Map.Height - cameraHalfHeight;

            Vector3 cameraPosition = camera.transform.position;
            if (left > right)
                cameraPosition.x = (left + right) / 2;
            else if (cameraPosition.x < left)
                cameraPosition.x = left;
            else if (cameraPosition.x > right)
                cameraPosition.x = right;
            if (bottom > top)
                cameraPosition.y = (bottom + top) / 2;
            else if (cameraPosition.y < bottom)
                cameraPosition.y = bottom;
            else if (cameraPosition.y > top)
                cameraPosition.y = top;
            camera.transform.position = cameraPosition;
        }
开发者ID:kidsang,项目名称:ProjectJ,代码行数:36,代码来源:SceneManager.cs

示例4: ChangeScene_

    void ChangeScene_( string pageid, Hashtable args )
    {
        if ( cur_scene_ != null ) {
            cur_scene_.Dispose();
            DestroyObject ( cur_scene_.gameObject );
            cur_scene_ = null;
        }

        string resource_path = page_resource_path_ + "/" + pageid;
        Object page_object = Resources.Load ( resource_path );
        if ( page_object == null ) {
            Debug.LogError("<SceneManager::ChangeScene> scene resource not found at " + resource_path );
        } else {
            cur_scene_ = ( (GameObject)Object.Instantiate ( page_object ) ).GetComponent<Scene>();
            cur_scene_.Init ( args );
        }
    }
开发者ID:OggYiu,项目名称:game_jam_project,代码行数:17,代码来源:SceneManager.cs

示例5: AddSceneToTop

 void AddSceneToTop(Scene scene)
 {
     mStack.Add(scene);
     scene.manager = this;
     scene.Init();
     scene.Activate();
 }
开发者ID:TheJare,项目名称:UnityUtils,代码行数:7,代码来源:Scene.cs

示例6: StartTest

        void StartTest()
        {
            GameObject sceneRoot = new GameObject("SceneRoot");
            scene = sceneRoot.AddComponent<Scene>();
            scene.Init();
            //SceneSetting sceneSetting = new SceneSetting(true);
            //sceneSetting.Map.CellCountX = 10;
            //sceneSetting.Map.CellCountY = 10;
            //scene.Load(sceneSetting);
            scene.Load("Settings/test.map");

            float mapWidth = scene.Map.Width;
            float mapHeight = scene.Map.Height;
            position = new Vector3(mapWidth / 2, mapHeight / 2, 0);
            for (int i = 0; i < 100; ++i)
            {
                MonsterEntity monsterEntity = scene.CreateMonsterEntity(0);
                scene.AddEntityToScene(monsterEntity, new Vector3(Random.value * mapWidth, Random.value * mapHeight, 0));
            }
        }
开发者ID:kidsang,项目名称:ProjectJ,代码行数:20,代码来源:TestCollectEntities.cs

示例7: Setup

 public void Setup(Device device, GameWindow window)
 {
     _scene = new Level(window, device, 1);
     _scene.Init();
 }
开发者ID:jvlppm,项目名称:pucpr-dx-cube_mario,代码行数:5,代码来源:MyGame.cs


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