当前位置: 首页>>代码示例>>C#>>正文


C# EnemyType类代码示例

本文整理汇总了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;
    }
开发者ID:jlonardi,项目名称:igp-DnM,代码行数:33,代码来源:EnemyManager.cs

示例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();
        }
开发者ID:GarethIW,项目名称:GravWalker,代码行数:29,代码来源:Boat.cs

示例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;
        }
开发者ID:anxkha,项目名称:Mortuum,代码行数:25,代码来源:EnemyFactory.cs

示例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);
 }
开发者ID:thk123,项目名称:Perspective,代码行数:27,代码来源:EnemyManager.cs

示例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);
 }
开发者ID:reqnux,项目名称:reqnux_TillDeath,代码行数:7,代码来源:MissionSpawner.cs

示例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;
        }
开发者ID:GarethIW,项目名称:GravWalker,代码行数:27,代码来源:RopeDude.cs

示例7: UpdateProperties

		void UpdateProperties ()
		{
			EnemyType = (EnemyType)Type;
			_speed = Speed;
			_rotateClockWise = (ClockwiseRotation == 0) ? true : false;
			_pathLength = PathLength;
		}
开发者ID:SteinLabs,项目名称:Gravity,代码行数:7,代码来源:EnemyArcade.cs

示例8: Wave

 public Wave(BossType bossType, float spawnDelay, int numberOfEnemies)
 {
     enemyType = EnemyType.Max;
     this.bossType = bossType;
     this.spawnDelay = spawnDelay;
     this.numberOfEnemies = numberOfEnemies;
 }
开发者ID:AliAkbarMontazeri,项目名称:AuroraTD,代码行数:7,代码来源:Wave.cs

示例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();
        }
开发者ID:GarethIW,项目名称:GravWalker,代码行数:25,代码来源:Spider.cs

示例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;
 }
开发者ID:M4T1A5,项目名称:FGJ2013,代码行数:8,代码来源:Enemy.cs

示例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;
        }
开发者ID:oneone1995,项目名称:90tank,代码行数:13,代码来源:Enemy.cs

示例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);
        }
开发者ID:broding,项目名称:bunkerhunter,代码行数:32,代码来源:PlayState.cs

示例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;
	}
开发者ID:aintech,项目名称:Heroes_of_Routine,代码行数:7,代码来源:Quest.cs

示例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();
        }
开发者ID:GarethIW,项目名称:GravWalker,代码行数:25,代码来源:Boss.cs

示例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;

                }
    }
开发者ID:nczempin,项目名称:Turn-the-Corner,代码行数:31,代码来源:Combat.cs


注:本文中的EnemyType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。