本文整理汇总了C#中Level.Init方法的典型用法代码示例。如果您正苦于以下问题:C# Level.Init方法的具体用法?C# Level.Init怎么用?C# Level.Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Level
的用法示例。
在下文中一共展示了Level.Init方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public void Init () {
level = new Level();
level.Init();
player = new Player();
player.pos = level.playerTile;
player.rotation = level.playerRotation;
turn = Turn.None;
enemies = new List<Enemy>();
}
示例2: LoadLevel
void LoadLevel(int level)
{
GameObject go = LoadResource("Prefab/LevelPrefab",true) as GameObject;
if (go != null)
{
go.transform.SetParent(UIRoot.transform);
go.transform.localPosition = Vector3.zero;
CurLevel = go.GetComponent<Level>();
CurLevel.Init(8, 7,null);
GetInstance().CurLevel.Shuffle();
}
}
示例3: LoadLevel
private void LoadLevel()
{
if (level != null) level.abilityPanel.DeselectAbility(level.abilityPanel.activeAbility, false);
UpdateMystery();
previousLevel = level;
if (previousLevel != null) {
previousLevel.SlideAway();
}
Texture2D levelData = GetLevelData(levelNumber);
if (levelData == null) {
EndScreen();
return;
}
GameObject go = new GameObject("level parent");
PlayerPrefs.SetInt("level", levelNumber);
level = go.AddComponent<Level>();
level.Init(levelData);
level.SlideIn();
}
示例4: InitSimulation
protected override void InitSimulation(int seed, LevelInfo level, PlayerInfo[] players, Slot[] slots)
{
Assembly levelAssembly = Assembly.Load(level.Type.AssemblyFile);
Type levelType = levelAssembly.GetType(level.Type.TypeName);
SimulationContext context = new SimulationContext(
ExtensionLoader.DefaultTypeResolver,
ExtensionLoader.ExtensionSettings);
simulation = Activator.CreateInstance(levelType, context) as Level;
// Player erzeugen
LevelSlot[] levelSlots = new LevelSlot[AntMe.Level.MAX_SLOTS];
for (int i = 0; i < AntMe.Level.MAX_SLOTS; i++)
{
// Skipp, falls nicht vorhanden
if (players[i] == null)
continue;
Assembly playerAssembly = Assembly.Load(players[i].Type.AssemblyFile);
Type factoryType = playerAssembly.GetType(players[i].Type.TypeName);
// Identify Name
var playerAttributes = factoryType.GetCustomAttributes(typeof(FactoryAttribute), true);
if (playerAttributes.Length != 1)
throw new Exception("Player does not have the right number of Player Attributes");
FactoryAttribute playerAttribute = playerAttributes[0] as FactoryAttribute;
// Find the right Mapping
var mappingAttributes = playerAttribute.GetType().
GetCustomAttributes(typeof(FactoryAttributeMappingAttribute), false);
if (mappingAttributes.Length != 1)
throw new Exception("Player Attribute has no valid Property Mapping Attribute");
FactoryAttributeMappingAttribute mappingAttribute = mappingAttributes[0] as FactoryAttributeMappingAttribute;
// Werte auslesen
string name = playerAttribute.GetType().GetProperty(mappingAttribute.NameProperty).
GetValue(playerAttribute, null) as string;
levelSlots[i] = new LevelSlot()
{
FactoryType = factoryType,
Name = name,
Color = slots[i].ColorKey,
Team = slots[i].Team
};
}
// Level initialisieren
simulation.Init(seed, levelSlots);
}