本文整理汇总了C#中Entity.AddFromPool方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.AddFromPool方法的具体用法?C# Entity.AddFromPool怎么用?C# Entity.AddFromPool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entity
的用法示例。
在下文中一共展示了Entity.AddFromPool方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildEntity
protected override void BuildEntity(EntityWorld entityWorld, Entity entity, ParameterCollection parameters)
{
entity.Transform.Position = parameters.Get<Vector2>(0);
entity.AddFromPool<CDrop>().Initialize(DropType.BlackBox);
entity.AddFromPool<CLifeTime>().Initialize(100f);
entity.Tag = EntityTags.Drop;
}
示例2: BuildEntity
protected override void BuildEntity(EntityWorld entityWorld, Entity entity, ParameterCollection parameters)
{
entity.Transform.Position = parameters.Get<Vector2>(0);
entity.AddFromPool<CDrop>().Initialize(DropType.Weapon);
entity.AddFromPool<CWeaponDrop>().Initialize(parameters.Get<WeaponType>(1));
entity.AddFromPool<CLifeTime>().Initialize(WeaponDropPrefab.LifeTime);
entity.Tag = EntityTags.Drop;
}
示例3: BuildEntity
protected override void BuildEntity(EntityWorld entityWorld, Entity entity, ParameterCollection parameters)
{
entity.Transform.Position = parameters.Get<Vector2>(0);
entity.AddFromPool<CRusherZombieAI>();
entity.AddFromPool<CZombieInfo>().Initialize(ZombieType.Rusher, RusherZombiePrefab.Size);
entity.AddFromPool<CHealth>().Initialize(10);
entity.Tag = EntityTags.Zombie;
}
示例4: BuildEntity
// todo: instead of doing something like this, how about make a callback "OnCollided(Entity entity (or Vector2 position tms))" and then the weapon itself (whos callback it will be calling) decides the damage etc. this.. could be A LOT better!
protected override void BuildEntity(EntityWorld entityWorld, Entity entity, ParameterCollection parameters)
{
const float Speed = SkypieaConstants.PixelsPerMeter * 25;
CTransform2D transform = parameters.Get<CTransform2D>(0);
entity.Transform.Position = transform.Position;
entity.Transform.Rotation = transform.Rotation;
entity.AddFromPool<CBullet>().Initialize(RocketLauncherBulletPrefab.BulletSize, parameters.Get<RocketLauncher>(1));
entity.AddFromPool<CVelocity2D>().Initialize(FlaiMath.GetAngleVector(transform.Rotation), Speed);
entity.AddFromPool<CParticleEmitter2D>().Initialize(ParticleEffectID.RocketSmoke, new BurstTriggerController(0.01f, entity.Transform));
}
示例5: BuildEntity
protected override void BuildEntity(EntityWorld entityWorld, Entity entity, ParameterCollection parameters)
{
CTransform2D transform = parameters.Get<CTransform2D>(0);
BulletWeapon weapon = parameters.Get<BulletWeapon>(1);
float angleOffset = parameters.GetOrDefault<float>(2);
float speed = parameters.GetOrDefault<float>(3, DefaultSpeed);
entity.Transform.Position = transform.Position;
entity.Transform.Rotation = transform.Rotation + angleOffset;
entity.AddFromPool<CBullet>().Initialize(NormalBulletPrefab.BulletSize, weapon);
entity.AddFromPool<CVelocity2D>().Initialize(FlaiMath.GetAngleVector(entity.Transform.Rotation), speed);
}
示例6: BuildEntity
protected override void BuildEntity(EntityWorld entityWorld, Entity entity, ParameterCollection parameters)
{
const float Speed = SkypieaConstants.PixelsPerMeter * 20;
CTransform2D transform = parameters.Get<CTransform2D>(0);
float rotationOffset = parameters.GetOrDefault<float>(2);
entity.Transform.Position = transform.Position;
entity.Transform.Rotation = transform.Rotation;
entity.AddFromPool<CBullet>().Initialize(BouncerBulletPrefab.BulletSize, parameters.Get<Bouncer>(1));
entity.AddFromPool<CVelocity2D>().Initialize(FlaiMath.GetAngleVector(transform.Rotation + rotationOffset), Speed);
entity.AddFromPool<CRotater2D>().Initialize(BouncerBulletPrefab.RotationAmount);
entity.AddFromPool<CBouncerBullet>().Initialize(3);
}
示例7: BuildEntity
protected override void BuildEntity(EntityWorld entityWorld, Entity entity, ParameterCollection parameters)
{
const float MaxAngleOffset = 0.3f;
const float Speed = SkypieaConstants.PixelsPerMeter * 14.25f;
CTransform2D transform = parameters.Get<CTransform2D>(0);
BulletWeapon weapon = parameters.Get<BulletWeapon>(1);
float angleOffset = Global.Random.NextFloat(-MaxAngleOffset, MaxAngleOffset);
entity.Transform.Position = transform.Position;
entity.Transform.Rotation = transform.Rotation + angleOffset;
entity.AddFromPool<CBullet>().Initialize(FlamethrowerBulletPrefab.BulletSize, weapon);
entity.AddFromPool<CVelocity2D>().Initialize(FlaiMath.GetAngleVector(entity.Transform.Rotation), Speed);
entity.AddFromPool<CLifeTime>().Initialize(0.5f);
}
示例8: BuildEntity
protected override void BuildEntity(EntityWorld entityWorld, Entity entity, ParameterCollection parameters)
{
entity.Transform.Position = parameters.Get<Vector2>(0);
entity.AddFromPool<CGoldenGoblinAI>().Initialize(entity.Transform.Position);
entity.AddFromPool<CZombieInfo>().Initialize(ZombieType.GoldenGoblin, GoldenGoblinPrefab.Size);
entity.AddFromPool<CHealth>().Initialize(125);
entity.AddFromPool<CParticleEmitter2D>().Initialize(ParticleEffectID.GoldenGoblinPath, new BurstTriggerController(0.025f, entity.Transform));
// okay.. awful... entities can have only one component of a single type so I must create a child entity...
// another option would be "CMultiParticleEmitter2D" tms
Entity childEntity = entityWorld.CreateEntity();
childEntity.AddFromPool<CParticleEmitter2D>().Initialize(ParticleEffectID.GoldenGoblinSpray, new BurstTriggerController(0.1f, entity.Transform));
entity.AttachChild(childEntity);
entity.Tag = EntityTags.Zombie;
}