本文整理汇总了C#中EnemyType类的典型用法代码示例。如果您正苦于以下问题:C# EnemyType类的具体用法?C# EnemyType怎么用?C# EnemyType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EnemyType类属于命名空间,在下文中一共展示了EnemyType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateEnemy
// make a new enemy and apply given rotation if applyRotation is set
public GameObject CreateEnemy(EnemyType enemyType, Vector3 position, Quaternion rotation)
{
GameObject enemyObject;
GameObject enemyPrefab;
// add enemycount
currentEnemyCount++;
// select correct prefab by enemy type
switch(enemyType) {
case EnemyType.LIZARD:
enemyPrefab = lizardPrefab;
break;
case EnemyType.WEREWOLF:
enemyPrefab = wolfPrefab;
break;
case EnemyType.ORC:
default:
enemyPrefab = orcPrefab;
break;
}
//if rotation is not set to null, apply it
if (rotation != Quaternion.identity){
enemyObject = (GameObject)Instantiate(enemyPrefab, position, rotation);
// else use prefabs rotation
} else {
enemyObject = (GameObject)Instantiate(enemyPrefab, position, enemyPrefab.transform.rotation);
}
return enemyObject;
}
示例2: Boat
public Boat(EnemyType type, Vector2 position, Texture2D sheet, int scene)
: base(type, position, sheet, scene)
{
spawnPosition = position;
numFrames = 1;
animTime = 50;
isAnimating = true;
animFrame = 0;
Speed = 0.003f;
frameSize = new Vector2(64,64);
frameOffset = new Vector2(32, 20);
hitRadius = 25;
centerOffestLength = 0;
fireRate = 50;
fireCountdown = 50;
HP = 20;
Target = GameManager.Hero.Position + Helper.AngleToVector(GameManager.Hero.spriteRot, 400f);
chopperSound = AudioController.effects["boat"].CreateInstance();
chopperSound.Volume = 0f;
chopperSound.IsLooped = true;
chopperSound.Play();
}
示例3: Create
public static Enemy Create(EnemyType enemyType, int level)
{
Enemy newEnemy;
switch (enemyType)
{
case EnemyType.Archer:
newEnemy = new Archer(_content, _graphics) { Level = level };
break;
case EnemyType.Guard:
newEnemy = new Guard(_content, _graphics) { Level = level };
break;
case EnemyType.Wizard:
newEnemy = new Wizard(_content, _graphics) { Level = level };
break;
case EnemyType.Soul:
newEnemy = new Soul(_content, _graphics);
break;
default:
throw new InvalidEnemyException(enemyType);
}
newEnemy.Load();
return newEnemy;
}
示例4: addEnemy
public void addEnemy(EnemyType type, Position pos, int lifetime = 10 * 1000, int maxDimensionOfMovement = int.MaxValue)
{
Enemy n;
switch (type)
{
case EnemyType.ZigZag0:
{
n = new ZigZag(type, pos, 0, lifetime, maxDimensionOfMovement);
break;
}
case EnemyType.ZigZag1:
{
n = new ZigZag(type, pos, 1, lifetime, maxDimensionOfMovement);
break;
}
case EnemyType.StraightLine:
{
n = new StraightLineEnemy(type, pos, lifetime, maxDimensionOfMovement);
break;
}
default:
{
throw new NotImplementedException();
}
}
enemies.Add(n);
}
示例5: spawnEnemy
public void spawnEnemy(EnemyType type, SpawnSide side)
{
Enemy enemy = EnemiesPool.pool.getEnemy(type);
enemy.transform.position = getSpawnPosition(side);
enemy.transform.rotation = Quaternion.identity;
enemy.gameObject.SetActive (true);
}
示例6: RopeDude
public RopeDude(EnemyType type, Vector2 position, Texture2D sheet, int scene)
: base(type, position, sheet, scene)
{
numFrames = 1;
animTime = 100;
isAnimating = false;
animFrame = 5;
Speed = 0.02f;
frameSize = new Vector2(16,16);
frameOffset = new Vector2(8, 0);
hitRadius = 10;
centerOffestLength = -8;
fireCountdown = 2000;
HP = 2;
ropeLengthMax = 100f + ((float)EnemyController.randomNumber.NextDouble() * 150f);
ropeLength = 0;
Target = Position + new Vector2(0, ropeLengthMax);
anchorPosition = Position;
}
示例7: UpdateProperties
void UpdateProperties ()
{
EnemyType = (EnemyType)Type;
_speed = Speed;
_rotateClockWise = (ClockwiseRotation == 0) ? true : false;
_pathLength = PathLength;
}
示例8: Wave
public Wave(BossType bossType, float spawnDelay, int numberOfEnemies)
{
enemyType = EnemyType.Max;
this.bossType = bossType;
this.spawnDelay = spawnDelay;
this.numberOfEnemies = numberOfEnemies;
}
示例9: Spider
public Spider(EnemyType type, Vector2 position, Rectangle loc, Texture2D sheet, int scene)
: base(type, position, sheet, scene)
{
spawnLocation = loc;
numFrames = 7;
animTime = 50;
isAnimating = true;
animFrame = 0;
Speed = 2f;
frameSize = new Vector2(64,64);
frameOffset = new Vector2(32, 32);
hitRadius = 25;
centerOffestLength = 0;
fireRate = 2000;
fireCountdown = 0;
HP = 15;
Target = NewTargetLocation();
}
示例10: Enemy
//Color Color)
public Enemy(Texture2D Texture, Vector2 Position, EnemyType Enemytype)
{
Type = Enemytype;
position = Position;
animator = new Animator(Texture, 2, 35, 55, 1, 2);
//color = Color;
}
示例11: Enemy
private EnemyType type; //定义敌人的类型
#endregion Fields
#region Constructors
public Enemy(EnemyType type, int x, int y, DIRECTION direct)
: base(x, y, GetLife(type), GetSpeed(type), GetPower(type), direct)
{
this.type = type;
this.Width = 60;
this.Height = 60;
}
示例12: Load
public override void Load()
{
GameManager.LevelBorderSize = new Vector2(250, 250);
GameManager.BulletLayer = new Layer();
GameManager.UILayer = new Layer();
GameManager.UILayer.Depth = 0.8f;
DamageIndicator.Initialize(GameManager.UILayer);
this.Level = new Level();
this.Player = new Player(GameManager.BulletLayer);
this.Player.Position = new Vector2(32, 0);
this.Director = new Director(this.Player, this.Level, GameManager.BulletLayer);
this.AddChild(this.Level);
this.AddChild(Player);
this.AddChild(GameManager.BulletLayer);
this.AddChild(GameManager.UILayer);
GameManager.currentDrawCamera.followNode = this.Player;
this.SpawnPlayer();
Enemy.Players = new List<Player>(4);
Enemy.Players.Add(this.Player);
EnemyType enemyType = new EnemyType();
Enemy enemy = enemyType.Pool.New();
enemy.Activate();
enemy.Position = this.Player.Position - new Vector2(64, 64);
this.AddChild(enemy);
}
示例13: Quest
public Quest (string title, string description, int rank, EnemyType enemyType, List<Sprite> winImages) {
this.title = title;
this.description = description;
this.rank = rank;
this.enemyType = enemyType;
this.winImages = winImages;
}
示例14: Boss
public Boss(EnemyType type, Vector2 position, Texture2D sheet, List<Point> path, bool loop, int pathnode, int scene)
: base(type, position, sheet, path, loop, pathnode, scene)
{
numFrames = 2;
animTime = 50;
isAnimating = true;
Speed = 0f;
frameSize = new Vector2(128,128);
frameOffset = new Vector2(64, 125);
hitRadius = 30 * scale;
centerOffestLength = 32 * scale;
fireRate = 50;
fireCountdown = 50;
HP = 150;
jeepSound = AudioController.effects["truck"].CreateInstance();
jeepSound.Volume = 0f;
jeepSound.IsLooped = true;
jeepSound.Play();
}
示例15: getModifier
public static int getModifier(WeaponType weaponType, EnemyType enemyType)
{
if (weaponType == WeaponType.BARE_HANDS) {
if (enemyType == EnemyType.Spider) {
return 1;
} else if (enemyType == EnemyType.Zombie) {
return -1;
} else {
return 0;
}
} else if (weaponType == WeaponType.STAFF) {
if (enemyType == EnemyType.Spider) {
return -1;
} else if (enemyType == EnemyType.Zombie) {
return 0;
} else {
return 1;
}
} else if (weaponType == WeaponType.SWORD) {
if (enemyType == EnemyType.Spider) {
return 0;
} else if (enemyType == EnemyType.Zombie) {
return 1;
} else {
return -1;
}
} else {
return 0;
}
}