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


C# GameEngine.AddEntity方法代码示例

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


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

示例1: onAttack

        public override void onAttack(GameEngine.TeeEngine engine, GameTime gameTime)
        {
            BeeProjectile attack = new BeeProjectile(Pos.X, Pos.Y, AttackTarget);
            attack.Damage = Damage;
            engine.AddEntity(attack);

            Stance = AttackStance.Retreating;
        }
开发者ID:behindcurtain3,项目名称:TheArena,代码行数:8,代码来源:Bee.cs

示例2: SpawnMob

        public void SpawnMob(GameEngine.TeeEngine engine)
        {
            string type = _splitMobs[randomGenerator.Next(0, _splitMobs.Count)];
            Vector2 pos = new Vector2(Pos.X + (CurrentBoundingBox.Width * (float)randomGenerator.NextDouble()), Pos.Y + (CurrentBoundingBox.Height * (float)randomGenerator.NextDouble()));
            Mob mob;

            switch (type)
            {
                case "Bat":
                    mob = new Bat(pos.X, pos.Y);
                    break;
                case "Bee":
                    mob = new Bee(pos.X, pos.Y);
                    break;
                default:
                    mob = new Bee(pos.X, pos.Y);
                    break;
            }

            engine.AddEntity(mob);
        }
开发者ID:behindcurtain3,项目名称:TheArena,代码行数:21,代码来源:MobSpawner.cs

示例3: SpawnCoins

        /// <summary>
        /// Spawns coins around the mob
        /// </summary>
        /// <param name="engine">The current engine, needed to add new coins entities to the game.</param>
        public void SpawnCoins(GameEngine.TeeEngine engine)
        {
            // Spawn gold
            float range = CurrentBoundingBox.Width * 2;
            int num = randomGenerator.Next(0, 6);
            float minX = Pos.X - range;
            float maxX = Pos.X + range;
            float minY = Pos.Y - range;
            float maxY = Pos.Y + range;

            for (int i = 0; i < num; i++)
            {
                int type = randomGenerator.Next(1, 10);
                float x = ((float)randomGenerator.NextDouble() * (maxX - minX) + minX);
                float y = ((float)randomGenerator.NextDouble() * (maxY - minY) + minY);
                Coin c;

                switch(type)
                {
                    case 6:
                    case 7:
                    case 8:
                        c = new Coin(Pos.X, Pos.Y, WorthGold * 2, CoinType.Silver, x, y);
                        break;
                    case 9:
                        c = new Coin(Pos.X, Pos.Y, WorthGold * 3, CoinType.Gold, x, y);
                        break;
                    default:
                        c = new Coin(Pos.X, Pos.Y, WorthGold, CoinType.Copper, x, y);
                        break;
                }

                engine.AddEntity(c);
            }

            _goldGiven = true;
        }
开发者ID:behindcurtain3,项目名称:TheArena,代码行数:41,代码来源:Mob.cs


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