本文整理汇总了C#中Level.init方法的典型用法代码示例。如果您正苦于以下问题:C# Level.init方法的具体用法?C# Level.init怎么用?C# Level.init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Level
的用法示例。
在下文中一共展示了Level.init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: setUpGame
void setUpGame()
{
GameObject goLevel = (GameObject)Instantiate(Resources.Load("Prefabs/Level"));
goLevel.transform.parent = transform;
level = goLevel.GetComponent<Level>();
level.init(new Rect(0, 0, 48, 48), 4);
GameObject goPlayer = (GameObject)Instantiate(Resources.Load("Prefabs/Player"));
Player player = goPlayer.GetComponent<Player>();
player.transform.position = new Vector3(level.bounds.center.x, 0, level.bounds.center.y);
}
示例2: Update
protected override void Update(GameTime gameTime)
{
Tuple<LevelState,int> tuple = level.Update(gameTime);
LevelState levelState = tuple.Item1;
if (levelState == LevelState.Exited) base.Exit();
else if (levelState == LevelState.Completed)
{
int index = (levels.FindIndex(delegate(Level current) { return level == current; }) + 1)%3;
level = levels.ElementAt(index);
level.init(tuple.Item2, gameTime);
}
else if (levelState == LevelState.NoLivesLeft) {
level = levels.ElementAt(0);
level.init(totalLives, gameTime);
}
base.Update(gameTime);
}