• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# GameEntity类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中GameEntity的典型用法代码示例。如果您正苦于以下问题:C# GameEntity类的具体用法?C# GameEntity怎么用?C# GameEntity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



GameEntity类属于命名空间,在下文中一共展示了GameEntity类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: InventoryComponent

 public InventoryComponent(GameEntity entity, int cap, int perSlot = 5)
     : base(entity)
 {
     capacity_ = cap;
     items_ = new GameEntity[capacity_];
     numberPerSlot_ = perSlot;
 }
开发者ID:BigDub,项目名称:HomePrototype,代码行数:7,代码来源:InventoryComponent.cs


示例2: PhysicsComponent

 public PhysicsComponent(GameEntity entity, Vector2 velocity, float spin, Vector2 growth)
     : this(entity)
 {
     velocity_ = velocity;
     spin_ = spin;
     growth_ = growth;
 }
开发者ID:BigDub,项目名称:HomePrototype,代码行数:7,代码来源:PhysicsComponent.cs


示例3: TileCoord

 public TileCoord(GameEntity entity, Point coord, Point size, TileSystemComponent tileSystem)
     : base(entity)
 {
     tileSystem_ = tileSystem;
     coord_ = coord;
     size_ = size;
 }
开发者ID:BigDub,项目名称:HomePrototype,代码行数:7,代码来源:TileCoord.cs


示例4: InstantControl

 public override void InstantControl( GameEntity control, TimeSpan gameTime )
 {
     float closestDistance = -1; // The distance to the closest tank
     Tank closestTank = null; // The closest tank
     // Find the closest living tank
     foreach ( Tank t in Tanks )
     {
         float dist = Vector2.DistanceSquared( Owner.Position, t.Position );
         if ( t.IsAlive )
         {
             if ( ( closestTank == null || dist < closestDistance ) )
             {
                 closestDistance = dist;
                 closestTank = t;
             }
         }
     }
     if ( closestTank != null ) // If no tank is alive don't do anything
     {
         // Set owner's angle
         float ang = Tools.Angle( control.Position, closestTank.Position );
         DeflectorController c = new DeflectorController( ang );
         control.AppendController( c );
     }
 }
开发者ID:nitzanbueno,项目名称:TanksDropTwo,代码行数:25,代码来源:Aimbot.cs


示例5: Control

 public override bool Control( GameEntity control, TimeSpan gameTime, Microsoft.Xna.Framework.Input.KeyboardState keyState )
 {
     if ( control is Projectile )
     {
         HashSet<Tank> tanks = new HashSet<Tank>();
         if ( control.Variables.ContainsKey( "Hypnotize" ) )
         {
             tanks = ( ( HashSet<Tank> )control.Variables[ "Hypnotize" ] );
         }
         if ( Vector2.Distance( control.Position, Owner.Position ) < rad )// && !Tools.IsGoingTowardsMe( Owner.Position, control.Angle, control.Position ) )
         {
             if ( !control.Variables.ContainsKey( "Hypnotize" ) || !tanks.Contains( Owner ) )
             {
                 DeflectorController d = new DeflectorController( Tools.Angle( Owner.Position, control.Position ) );
                 control.AppendController( d );
                 tanks.Add( Owner );
             }
         }
         else
         {
             tanks.Remove( Owner );
         }
         control.Variables[ "Hypnotize" ] = tanks;
     }
     return base.Control( control, gameTime, keyState );
 }
开发者ID:nitzanbueno,项目名称:TanksDropTwo,代码行数:26,代码来源:Hypnotizer.cs


示例6: DriftPhysics

 public DriftPhysics(GameEntity entity, Vector2 drift, Vector2 speed, float d_speed)
     : base(entity, Vector2.Zero, 0, Vector2.Zero)
 {
     max_drift = drift;
     max_speed = speed;
     drift_speed = d_speed;
 }
开发者ID:BigDub,项目名称:HomePrototype,代码行数:7,代码来源:DriftPhysics.cs


示例7: Use

        public void Use(Seizonsha game, GameEntity entity)
        {
            // entity is whatever is using this

            //			if (entity.isFrozen())
            //			{
            //				return;
            //			}
            recharged = 0;
            // entity.Freeze(recharge_time);
            int damageType = Static.DAMAGE_TYPE_NO_DAMAGE;
            if (entity.getTargetType() == Static.TARGET_TYPE_FRIENDLY){
                damageType = Static.DAMAGE_TYPE_FRIENDLY;
            }
            if (entity.getTargetType() == Static.TARGET_TYPE_ENEMY){
                damageType = Static.DAMAGE_TYPE_ENEMY;
            }
            Rectangle slashBounds = new Rectangle(	entity.getCenterX(),
                                                    entity.getCenterY(),
                                                    Static.PLAYER_WIDTH/2,
                                                    Static.PLAYER_HEIGHT/2);

            //Rectangle bulletBounds = new Rectangle(

            game.Spawn(new Bullet(game, game.getTestSprite(slashBounds, Color.Red), slashBounds, damage, damageType, 1, bulletSpeed, entity.alexDirection));

            // game sprite bounds amount dmgAmount dmgType duration bulletSpeed
        }
开发者ID:ClintPearce,项目名称:Seizonsha,代码行数:28,代码来源:Gun.cs


示例8: Update

 public void Update(Seizonsha game, GameEntity entity)
 {
     if (recharged < recharge_time)
     {
         recharged++;
     }
 }
开发者ID:ClintPearce,项目名称:Seizonsha,代码行数:7,代码来源:Gun.cs


示例9: SpatialComponent

 public SpatialComponent(GameEntity entity, Vector2 translation, float rotation, Vector2 scale)
     : base(entity)
 {
     translation_ = translation;
     rotation_ = rotation;
     scale_ = scale;
 }
开发者ID:BigDub,项目名称:HomePrototype,代码行数:7,代码来源:SpatialComponent.cs


示例10: Control

 public override bool Control( GameEntity control, TimeSpan gameTime, Microsoft.Xna.Framework.Input.KeyboardState keyState )
 {
     if ( selectedTank == null )
     {
         List<Tank> TanksCopy = new List<Tank>( Tanks );
         if ( TanksCopy.Count == 0 )
             return true;
         int i = r.Next( TanksCopy.Count );
         while ( TanksCopy[ i ].Controller is MindController )
         {
             TanksCopy.RemoveAt( i );
             i = r.Next( TanksCopy.Count );
             if ( TanksCopy.Count == 0 )
                 return true;
         }
         selectedTank = TanksCopy[ i ];
     }
     if ( controlKeys == null )
     {
         controlKeys = selectedTank.Keys;
         selectedTank.Keys = Owner.Keys;
         Owner.Keys = new KeySet( Keys.None, Keys.None, Keys.None, Keys.None, Owner.Keys.KeyPlace, Keys.None );
     }
     base.Control( control, gameTime, keyState );
     return true;
 }
开发者ID:nitzanbueno,项目名称:TanksDropTwo,代码行数:26,代码来源:MindController.cs


示例11: PumpController

 public PumpController(GameEntity e)
     : base(e)
 {
     processTime_ = 1;
     isDrawn = true;
     search = true;
 }
开发者ID:BigDub,项目名称:HomePrototype,代码行数:7,代码来源:PumpController.cs


示例12: WorldController

        public WorldController(GameEntity entity, Point screen)
            : base(entity)
        {
            screen_ = screen;

            Locator.getMessageBoard().register(listen);
        }
开发者ID:BigDub,项目名称:HomePrototype,代码行数:7,代码来源:WorldController.cs


示例13: createEndGameFlame

 public GameEntity createEndGameFlame()
 {
     GameEntity e = new GameEntity();
     e.render = new RenderComponent(e, Locator.getTextureManager().loadTexture("flame"), 0, new Vector2(96, 40), Color.White);
     e.spatial = new SpatialComponent(e, Locator.getShip().entity_.spatial, new Vector2(-16, 336), 0, Vector2.One);
     return e;
 }
开发者ID:BigDub,项目名称:HomePrototype,代码行数:7,代码来源:ObjectFactory.cs


示例14: ExitState

        public override void ExitState(GameEntity unit)
        {
            base.ExitState(unit);

            unit.StopMovement();
            Debug.Log("Stopping chasing enemy");
        }
开发者ID:Zopherus,项目名称:FBLA-Game,代码行数:7,代码来源:ChaseState.cs


示例15: CreateEntityWithId

        public GameEntity CreateEntityWithId(string id, string name)
        {
            // look in the pool
            if (deadEntityPool.ContainsKey(name) && deadEntityPool[name].Any())
            {
                var entity = deadEntityPool[name].Pop();
                BindEntityEventRegistration(id, entity);
                return entity;
            }
            else
            {
                // clone it
                GameEntity entity = new GameEntity();
                GameEntity source = _entitySource.GetOriginalEntity(name);

                if (GetNumberAlive(name) >= source.MaxAlive) return null;

                foreach (Component c in source.Components)
                {
                    entity.AddComponent(c.Clone());
                }
                entity.Name = source.Name;
                entity.OnDeath = source.OnDeath;
                entity.IsGravitySensitive = source.IsGravitySensitive;

                BindEntityEventRegistration(id, entity);

                return entity;
            }
        }
开发者ID:Tesserex,项目名称:C--MegaMan-Engine,代码行数:30,代码来源:GameEntityPool.cs


示例16: Removing

 public Removing(GameEntity entity)
 {
     entity_ = entity;
     currentTime_ = 0;
     processTime_ = 0.5f;
     bar_ = new UI.ProgressBar(50);
 }
开发者ID:BigDub,项目名称:HomePrototype,代码行数:7,代码来源:Removing.cs


示例17: UpdateState

        public override void UpdateState(GameEntity unit)
        {
            base.UpdateState(unit);

            if (_unitToAttack == null || _unitToAttack.IsDead())
            {
                unit.GetStateMachine().ChangeState(new RestState());
                return;
            }

            Vector3 unitToAttackPos = _unitToAttack.GetPos();

            // As the unit must move towards a dynamic position.
            unit.MoveTo(unitToAttackPos);

            float extra = _unitToAttack is GameBuilding ? GameBuilding.EXTRA_ATTACK_DIST : 0.0f;
            float attackRange = unit.GetAttackRange() + extra;

            // Is the unit within attacking distance of the unit to attack?
            float distance = Vector3.Distance(unitToAttackPos, unit.GetPos());
            if (distance < (attackRange - ARRIVE_THRESHOLD))
            {
                // Start attacking the other object.
                unit.GetStateMachine().ChangeState(new AttackState(_unitToAttack));
            }
        }
开发者ID:Zopherus,项目名称:FBLA-Game,代码行数:26,代码来源:ChaseState.cs


示例18: refresh

 public void refresh(GameEntity item)
 {
     item_ = item;
     count_.text_ = "" + item.item.number_;
     count_.pack();
     count_.loc_ = new Vector2(buttonSize) - count_.size;
 }
开发者ID:BigDub,项目名称:HomePrototype,代码行数:7,代码来源:ItemButton.cs


示例19: PlayerControllerComponent

 public PlayerControllerComponent(GameEntity entity)
     : base(entity)
 {
     keys = new bool[4];
     direction = Vector2.Zero;
     dir_dirty = true;
 }
开发者ID:BigDub,项目名称:HomePrototype,代码行数:7,代码来源:PlayerControllerComponent.cs


示例20: ProductionComponent

 public ProductionComponent(GameEntity entity, ItemInfo input, ItemInfo output, float productionTime)
     : base(entity, 2)
 {
     input_ = input;
     output_ = output;
     productionTime_ = productionTime;
 }
开发者ID:BigDub,项目名称:HomePrototype,代码行数:7,代码来源:ProductionComponent.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# GameEvent类代码示例发布时间:2022-05-24
下一篇:
C# GameEngine类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap