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


C# Entity.AddFromPool方法代码示例

本文整理汇总了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;
 }
开发者ID:JaakkoLipsanen,项目名称:Skypiea,代码行数:7,代码来源:BlackBoxPrefab.cs

示例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;
 }
开发者ID:JaakkoLipsanen,项目名称:Skypiea,代码行数:8,代码来源:WeaponDropPrefab.cs

示例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;
 }
开发者ID:JaakkoLipsanen,项目名称:Skypiea,代码行数:8,代码来源:RusherZombiePrefab.cs

示例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));
        }
开发者ID:JaakkoLipsanen,项目名称:Skypiea,代码行数:13,代码来源:RocketLauncherBulletPrefab.cs

示例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);
        }
开发者ID:JaakkoLipsanen,项目名称:Skypiea,代码行数:13,代码来源:NormalBulletPrefab.cs

示例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);
        }
开发者ID:JaakkoLipsanen,项目名称:Skypiea,代码行数:14,代码来源:BouncerBulletPrefab.cs

示例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);
        }
开发者ID:JaakkoLipsanen,项目名称:Skypiea,代码行数:16,代码来源:FlamethrowerBulletPrefab.cs

示例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;
        }
开发者ID:JaakkoLipsanen,项目名称:Skypiea,代码行数:16,代码来源:GoldenGoblinPrefab.cs


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