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


C# GameEntity类代码示例

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


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


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