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


C# Enemy.Initialize方法代码示例

本文整理汇总了C#中Enemy.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# Enemy.Initialize方法的具体用法?C# Enemy.Initialize怎么用?C# Enemy.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Enemy的用法示例。


在下文中一共展示了Enemy.Initialize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitializeParts

        public void InitializeParts()
        {
            mainEmitter = new BulletEmitter(this, Origin, false);
            mainEmitter.LockedToParentPosition = true;
            mainEmitter.LockPositionOffset = Vector2.Zero;

            ring1 = new Enemy(thisScene, Origin);
            ring1.Initialize();
            ring1.DeletionBoundary = DeletionBoundary;
            ring1.DrawAtTrueRotation = true;
            ring1.Color = Color.White;
            ring1.Origin = Origin;
            ring1.SetParent(this);
            ring1.SetTexture(boss5Ring1Texture);
            ring1.LockedToParentPosition = true;
            ring1.Center = this.Center;
            ring1.DrawLayer = .32f;

            ring2 = new Enemy(thisScene, Origin);
            ring2.Initialize();
            ring2.DeletionBoundary = DeletionBoundary;
            ring2.DrawAtTrueRotation = true;
            ring2.Color = Color.White;
            ring2.Origin = Origin;
            ring2.SetParent(this);
            ring2.SetTexture(boss5Ring2Texture);
            ring2.LockedToParentPosition = true;
            ring2.Center = this.Center;
            ring2.DrawLayer = .31f;

            ring1Emitters = new List<BulletEmitter>()
            {
                new BulletEmitter(ring1, new Vector2(130, 175)),
                new BulletEmitter(ring1, new Vector2(130, 294)),
                new BulletEmitter(ring1, new Vector2(381, 175)),
                new BulletEmitter(ring1, new Vector2(381, 294))
            };

            ring2Emitters = new List<BulletEmitter>()
            {
                new BulletEmitter(ring2, new Vector2(195, 110)),
                new BulletEmitter(ring2, new Vector2(117, 234.5f)),
                new BulletEmitter(ring2, new Vector2(195, 359)),
                new BulletEmitter(ring2, new Vector2(316, 110)),
                new BulletEmitter(ring2, new Vector2(394, 234.5f)),
                new BulletEmitter(ring2, new Vector2(316, 359))
            };

            // Setup the ring emitter properties.
            foreach (BulletEmitter be in ring1Emitters)
            {
                be.Center = Center + (be.Center - Origin);
                be.DeletionBoundary = new Vector2(99999, 99999);
                be.CustomValue1 = Vector2.Distance(Center, be.Center);
                be.Rotation = VectorMathHelper.GetAngleTo(Center, be.Center);
            }

            // Setup the ring emitter properties.
            foreach (BulletEmitter be in ring2Emitters)
            {
                be.Center = Center + (be.Center - Origin);
                be.DeletionBoundary = new Vector2(99999, 99999);
                be.CustomValue1 = Vector2.Distance(Center, be.Center);
                be.Rotation = VectorMathHelper.GetAngleTo(Center, be.Center);
            }

            topLayer = new Enemy(thisScene, Origin);
            topLayer.Initialize();
            topLayer.DeletionBoundary = DeletionBoundary;
            topLayer.Color = Color.White;
            topLayer.Origin = Origin;
            topLayer.SetTexture(boss5TopTexture);
            topLayer.SetParent(this);
            topLayer.LockedToParentPosition = true;
            topLayer.Center = this.Center;
            topLayer.DrawLayer = .3f;

            rotatingBullets = new List<Bullet>();
        }
开发者ID:cmark89,项目名称:AsteroidRebuttal,代码行数:79,代码来源:FinalBoss.cs

示例2: AddEnemy

        /// <summary>
        /// Spawn enemy on the level
        /// </summary>
        private void AddEnemy()
        {
            //Create the animation object
            Animation enemyAnimation = new Animation();

            //Initialize the animation
            enemyAnimation.Initialize(
                enemyTexture,
                Vector2.Zero,
                47, 61,
                8,
                30,
                Color.White,
                1f,
                true);

            //Generate random enemy position
            Vector2 position = new Vector2(
                GraphicsDevice.Viewport.Width + enemyTexture.Width / 2,
                random.Next(100, GraphicsDevice.Viewport.Height - 100));

            //Create enemy and add to the enemy list
            Enemy enemy = new Enemy();
            enemy.Initialize(enemyAnimation, position);
            enemies.Add(enemy);
        }
开发者ID:ElementZn,项目名称:ship-game,代码行数:29,代码来源:Game1.cs

示例3: AddEnemy

        private void AddEnemy()
        {
            Animation enemyAnimation = new Animation();
            enemyAnimation.Initialize(enemyTexture, Vector2.Zero, 47, 61, 8, 30, Color.White, 1f, true);

            Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + enemyTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100));

            Enemy enemy = new Enemy();
            enemy.Initialize(enemyAnimation, position);
            enemies.Add(enemy);
        }
开发者ID:urvaius,项目名称:Win8ShooterGame,代码行数:11,代码来源:Game1.cs

示例4: Initialize

    /// <summary>
    /// Allows the game to perform any initialization it needs to before starting to run.
    /// This is where it can query for any required services and load any non-graphic
    /// related content.  Calling base.Initialize will enumerate through any components
    /// and initialize them as well.
    /// </summary>
    protected override void Initialize()
    {
        // TODO: Add your initialization logic here

            base.Initialize();
            player = new Player(this);
            bullet = new Bullet(this);
            weapon = new Weapons(this);
            particle = new Particle(this);
            Enemy_List = new List<Enemy>();
            Particle_list = new List<Particle>();
            enemy = new Enemy(this);
            player.Initialize();
            bullet.Initialize();
            enemy.Initialize();
    }
开发者ID:Ziika,项目名称:Project,代码行数:22,代码来源:Game1.cs

示例5: ScatterEnemies

        private static List<Enemy> ScatterEnemies(Game game, int numEnemies,
            float minDistance, int distance, Player player)
        {
            List<Enemy> enemyList = new List<Enemy>();

            for (int i = 0; i < numEnemies; i++)
            {
                Enemy enemy = new Enemy(game, UnitTypes.EnemyType.Beast);
                enemy.Initialize();

                // Generate a random position
                Vector3 offset = RandomHelper.GeneratePositionXZ(distance);
                while (Math.Abs(offset.X) < minDistance && Math.Abs(offset.Z) < minDistance)
                    offset = RandomHelper.GeneratePositionXZ(distance);

                enemy.Transformation = new Transformation(player.Transformation.Translate +
                    offset, Vector3.Zero, /*Vector3.One*/ new Vector3((float)0.3, (float)0.3, (float)0.3));
                enemy.TransformationOld = enemy.Transformation;

                enemy.Player = player;
                enemyList.Add(enemy);
            }

            return enemyList;
        }
开发者ID:Oliverreason,项目名称:sitsdev,代码行数:25,代码来源:LevelCreator.cs


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