本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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 );
}
}
示例5: AddSceneToTop
void AddSceneToTop(Scene scene)
{
mStack.Add(scene);
scene.manager = this;
scene.Init();
scene.Activate();
}
示例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));
}
}
示例7: Setup
public void Setup(Device device, GameWindow window)
{
_scene = new Level(window, device, 1);
_scene.Init();
}