本文整理汇总了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;
}
示例2: PhysicsComponent
public PhysicsComponent(GameEntity entity, Vector2 velocity, float spin, Vector2 growth)
: this(entity)
{
velocity_ = velocity;
spin_ = spin;
growth_ = growth;
}
示例3: TileCoord
public TileCoord(GameEntity entity, Point coord, Point size, TileSystemComponent tileSystem)
: base(entity)
{
tileSystem_ = tileSystem;
coord_ = coord;
size_ = size;
}
示例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 );
}
}
示例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 );
}
示例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;
}
示例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
}
示例8: Update
public void Update(Seizonsha game, GameEntity entity)
{
if (recharged < recharge_time)
{
recharged++;
}
}
示例9: SpatialComponent
public SpatialComponent(GameEntity entity, Vector2 translation, float rotation, Vector2 scale)
: base(entity)
{
translation_ = translation;
rotation_ = rotation;
scale_ = scale;
}
示例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;
}
示例11: PumpController
public PumpController(GameEntity e)
: base(e)
{
processTime_ = 1;
isDrawn = true;
search = true;
}
示例12: WorldController
public WorldController(GameEntity entity, Point screen)
: base(entity)
{
screen_ = screen;
Locator.getMessageBoard().register(listen);
}
示例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;
}
示例14: ExitState
public override void ExitState(GameEntity unit)
{
base.ExitState(unit);
unit.StopMovement();
Debug.Log("Stopping chasing enemy");
}
示例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;
}
}