本文整理汇总了C#中GameData.SpawnPlayer方法的典型用法代码示例。如果您正苦于以下问题:C# GameData.SpawnPlayer方法的具体用法?C# GameData.SpawnPlayer怎么用?C# GameData.SpawnPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameData
的用法示例。
在下文中一共展示了GameData.SpawnPlayer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NewGame
public static void NewGame()
{
auto = false;
data = new GameData();
enemyController = new EnemyController();
ILevelBuilder generator = new LevelGenerator();
data.level = generator.Generate();
for (int i = 0; i < data.level.doors.Count; i++)
{
data.level.doors[i].Init();
}
data.SpawnPlayer();
//DEBUG STUFF
//data.inventory.Add(ItemLibrary.Get().items[5], 1);
foreach (IGameDataChangeListener listener in GAMEDATA_CHANGE_LISTENERS)
{
listener.OnGameDataChange(data);
}
//ConsolePseudoRaycast.CastRay(new Vector2(14, 1), new Vector2(16, 3));
//Console.ReadKey();
}
示例2: TakeDamage
public void TakeDamage(float value, string dmgtype, float pen)
{
data = Application.GetData();
Armor armor = this.Armor.content;
//DAMAGE CALC WITH DAMAGE TYPE AND ARMOR TYPE AND STUFF
value = ApplyArmor(value, dmgtype, armor, pen);
health -= Math.Max((int)value, 0);
if (this != data.player)
{
data.combatlog.Add("...Enemy took " + (int)value + " damage");
}
if (this == data.player)
{
data.combatlog.Add("Hit. " + (int)value + " damage taken");
}
data.score.AddScore((int)value);
if (this != data.player && health <= 0)
{
data.combatlog.Add(name + " defeated");
#region scores
if (this.name == "alien_assaulter")
{
data.score.AddScore(25);
data.player.AddExperience(10);
}
if (this.name == "alien_trooper")
{
data.score.AddScore(20);
data.player.AddExperience(10);
}
if (this.name == "cyberbear")
{
data.score.AddScore(75);
data.player.AddExperience(50);
}
#endregion
data.level.enemies.Remove(this);
data.collision.Remove(this);
}
if (this == data.player && health <= 0)
{
data.collision.Remove(data.player);
data.player = new Actor();
data.SpawnPlayer();
Console.WriteLine("YOU DIED");
Console.WriteLine("Press any key to continue\n");
Application.ChangeGameState(GameStates.FINISH);
}
}