本文整理汇总了C#中EnemyType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# EnemyType.ToString方法的具体用法?C# EnemyType.ToString怎么用?C# EnemyType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EnemyType
的用法示例。
在下文中一共展示了EnemyType.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NPC
public NPC(Texture2D texture, EnemyType type)
: base(texture)
{
this.Type = type;
this.Position = Constants.ENTITY_RIGHT_POSITION;
this.AnimationController.Initialize(this.Position, new Vector2(12.0f, 8.0f), Constants.ENTITY_DEFAULT_TEXTURE);
switch (this.Type)
{
case EnemyType.Zombie:
case EnemyType.Ghoul:
base.AnimationController.StartFrame = 3.00f;
base.AnimationController.EndFrame = 220.25f;
base.AnimationController.DefaultFrameX = 73.75f;
break;
case EnemyType.Skeleton:
case EnemyType.Warrior:
base.AnimationController.StartFrame = 225.25f;
base.AnimationController.EndFrame = 440.5f;
base.AnimationController.DefaultFrameX = 295.0f;
break;
case EnemyType.Butcher:
case EnemyType.Mindless:
base.AnimationController.StartFrame = 442.5f;
base.AnimationController.EndFrame = 661.75f;
base.AnimationController.DefaultFrameX = 516.25f;
break;
case EnemyType.Gladiator:
case EnemyType.InfestedHuman:
base.AnimationController.StartFrame = 663.75f;
base.AnimationController.EndFrame = 883.00f;
base.AnimationController.DefaultFrameX = 737.50f;
break;
default: throw new Exception("Invalid enemy type " + type.ToString() + "!");
}
switch (this.Type)
{
case EnemyType.Zombie:
case EnemyType.Skeleton:
case EnemyType.Butcher:
case EnemyType.Gladiator:
this.AnimationController.DefaultFrameY = 194;
break;
case EnemyType.Ghoul:
case EnemyType.Warrior:
case EnemyType.Mindless:
case EnemyType.InfestedHuman:
this.AnimationController.DefaultFrameY = 582;
break;
}
this.AnimationController.CurrentFrame = new Vector2(this.AnimationController.StartFrame, 0.0f);
}
示例2: Instantiate
public void Instantiate(BroWorldApplication application, GameObject prefab, EnemyType type)
{
// Model
application.model.AddEnemy(_model);
int id = _model.id;
// View
GameObject viewInstance = GameObject.Instantiate(prefab);
viewInstance.name = type.ToString() + id;
viewInstance.transform.parent = application.view.transform;
_view = viewInstance.GetComponent<EnemyView>();
// Controller
GameObject controllerInstance = new GameObject(type.ToString() + "Controller" + id);
_controller = controllerInstance.AddComponent<EnemyController>();
_controller.enabled = false;
_controller.EnemyModel = _model;
_controller.EnemyView = _view;
_controller.enabled = true;
controllerInstance.transform.parent = application.controller.transform;
}
示例3: InvalidEnemyException
public InvalidEnemyException(EnemyType enemyType)
: base("Invalid enemy type: " + enemyType.ToString())
{
}
示例4: GetTexture
public static string GetTexture(EnemyType type)
{
return type.ToString("g");
}
示例5: SpawnRandomAsteroid
private void SpawnRandomAsteroid(EnemyType eType)
{
int color = rand.Next(0, 4);
EnemyColor eColor = EnemyColor.NONE;
switch (color)
{
case 0:
eColor = EnemyColor.RED;
break;
case 1:
eColor = EnemyColor.BLUE;
break;
case 2:
eColor = EnemyColor.GREEN;
break;
case 3:
eColor = EnemyColor.PURPLE;
break;
case 4:
eColor = EnemyColor.PINK;
break;
}
Enemy enemy = new Enemy(eType, enemyTextures[eType.ToString() + "_" + eColor.ToString()], eColor);
int direction = rand.Next(0, 3); // Generate a number 0 - 3 [0, 1, 2, 3] to determine what side to spawn on.
switch (direction)
{
case 0: // Top
enemy.Position = new Vector2(rand.Next(100, ActionScreen.background.Width - 100), 100);
break;
case 1: // Bottom
enemy.Position = new Vector2(rand.Next(100, ActionScreen.background.Width - 100), ActionScreen.background.Height - 100);
break;
case 2: // Left
enemy.Position = new Vector2(100, rand.Next(100, ActionScreen.background.Height - 100));
break;
case 3: // Right
enemy.Position = new Vector2(rand.Next(ActionScreen.background.Width + 50, ActionScreen.background.Width - 50), rand.Next(-50, ActionScreen.background.Height + 50));
break;
}
enemy.Velocity += new Vector2(rand.Next(-enemy.Speed, enemy.Speed), rand.Next(-enemy.Speed, enemy.Speed));
enemy.Transformation = Matrix.CreateTranslation(new Vector3(-enemy.Center, 0.0f)) *
// Matrix.CreateScale(block.Scale) * would go here
Matrix.CreateRotationZ(enemy.Angle) *
Matrix.CreateTranslation(new Vector3(enemy.Position, 0.0f));
enemies.Add(enemy);
ParticleManager.particleEffects["WarpIn"].Trigger(enemy.Position);
}