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


C# Entity.GetCollRectangle方法代码示例

本文整理汇总了C#中Entity.GetCollRectangle方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.GetCollRectangle方法的具体用法?C# Entity.GetCollRectangle怎么用?C# Entity.GetCollRectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Entity的用法示例。


在下文中一共展示了Entity.GetCollRectangle方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TrailParticle

        public TrailParticle(Entity source, Color color)
        {
            Texture = GameWorld.ParticleSpriteSheet;
            CollRectangle = new Rectangle(source.GetCollRectangle().Center.X, source.GetCollRectangle().Center.Y, 8, 8);
            SourceRectangle = new Rectangle(8, 0, 8, 8);
            int buffer = 1;
            Velocity.X = GameWorld.RandGen.Next((int)-source.GetVelocity().X - buffer, (int)-source.GetVelocity().X + buffer + 1) * (float)GameWorld.RandGen.NextDouble();
            Velocity.Y = GameWorld.RandGen.Next((int)-source.GetVelocity().Y - buffer, (int)-source.GetVelocity().Y + buffer + 1);
            Position = new Vector2(CollRectangle.X, CollRectangle.Y);
            Opacity = .5f;

            light = new Lights.DynamicPointLight(this, .5f, false, color, 1);
            GameWorld.Instance.LightEngine.AddDynamicLight(light);
        }
开发者ID:DuckKnightDuel,项目名称:Adam,代码行数:14,代码来源:Particle.cs

示例2: Generate

 /// <summary>
 /// Generates specified number of gems in gameworld.
 /// </summary>
 /// <param name="count"></param>
 /// <param name="entity"></param>
 public static void Generate(int count, Entity entity)
 {
     for (int i = 0; i < count; i++)
     {
         Gem gem = new Gem(entity.GetCollRectangle().Center.X, entity.GetCollRectangle().Center.Y);
         GameWorld.Instance.Entities.Add(gem);
     }
 }
开发者ID:DuckKnightDuel,项目名称:Adam,代码行数:13,代码来源:Gem.cs

示例3: StompSmokeParticle

        public StompSmokeParticle(Entity entity)
        {
            Texture = ContentHelper.LoadTexture("Effects/smoke");
            CollRectangle = new Rectangle(entity.GetCollRectangle().Center.X - 4, entity.GetCollRectangle().Bottom - 4, 8, 8);
            SourceRectangle = new Rectangle(8 * GameWorld.RandGen.Next(0, 4), 0, 8, 8);
            Position = new Vector2(CollRectangle.X, CollRectangle.Y);

            Velocity.X = (float)GameWorld.RandGen.NextDouble() * GameWorld.RandGen.Next(-3, 3);
            Velocity.Y = (float)GameWorld.RandGen.NextDouble() * -1f;

            Opacity = 1f;
        }
开发者ID:DuckKnightDuel,项目名称:Adam,代码行数:12,代码来源:Particle.cs

示例4: Generate

 public static void Generate(int count, Entity entity)
 {
     for (int i = 0; i < count; i++)
     {
         int x = GameWorld.RandGen.Next(entity.GetCollRectangle().X, entity.GetCollRectangle().X+  entity.GetCollRectangle().Width - 4);
         int y = GameWorld.RandGen.Next(entity.GetCollRectangle().Y, entity.GetCollRectangle().Y + entity.GetCollRectangle().Height - 4);
         TestSmokeParticle par = new TestSmokeParticle(x, y);
         GameWorld.Instance.Particles.Add(par);
     }
 }
开发者ID:DuckKnightDuel,项目名称:Adam,代码行数:10,代码来源:Particle.cs

示例5: SparkParticle

        public SparkParticle(Entity source, Color color)
        {
            SourceRectangle = new Rectangle(272, 96, 8, 8);
            Texture = GameWorld.SpriteSheet;
            CollRectangle = new Rectangle(source.GetCollRectangle().X  - 4, source.GetCollRectangle().Y + 4, 8, 8);
            Velocity.X = GameWorld.RandGen.Next(-6, 7);
            Position = new Vector2(CollRectangle.X, CollRectangle.Y);
            Opacity = .7f;

            light = new DynamicPointLight(this, .05f, false, color, .5f);
            GameWorld.Instance.LightEngine.AddDynamicLight(light);
        }
开发者ID:DuckKnightDuel,项目名称:Adam,代码行数:12,代码来源:Particle.cs

示例6: EntityFlameParticle

        public EntityFlameParticle(Entity source, Color color)
        {
            SourceRectangle = new Rectangle(32 * 8, 12 * 8, 8, 8);
            Texture = GameWorld.SpriteSheet;
            int randX = (int)(GameWorld.RandGen.Next(0, source.GetCollRectangle().Width) * GameWorld.RandGen.NextDouble());
            int randY = (int)(GameWorld.RandGen.Next(0, source.GetCollRectangle().Height) * GameWorld.RandGen.NextDouble());
            CollRectangle = new Rectangle(source.GetCollRectangle().X + randX - 4, source.GetCollRectangle().Y + randY - 4, 8, 8);
            Position = new Vector2(CollRectangle.X, CollRectangle.Y);
            Opacity = .5f;

            Velocity.X = (float)(GameWorld.RandGen.Next(-1, 2) * GameWorld.RandGen.NextDouble());
            Velocity.Y = -3f;

            light = new DynamicPointLight(this, .5f, false, color, .5f);
            GameWorld.Instance.LightEngine.AddDynamicLight(light);
        }
开发者ID:DuckKnightDuel,项目名称:Adam,代码行数:16,代码来源:Particle.cs

示例7: CreateTookDamage

 public void CreateTookDamage(Entity entity)
 {
     CurrentParticle = ParticleType.TookDamage;
     Texture = ContentHelper.LoadTexture("Sparkles");
     CollRectangle = new Rectangle(GameWorld.RandGen.Next(entity.GetCollRectangle().X, entity.GetCollRectangle().Right - 8), GameWorld.RandGen.Next(entity.GetCollRectangle().Y, entity.GetCollRectangle().Bottom - 8), 8, 8);
     SourceRectangle = new Rectangle(0, 0, 8, 8);
     Velocity.X = (float)(GameWorld.RandGen.NextDouble() * GameWorld.RandGen.Next(-4, 5));
     Velocity.Y = (float)(GameWorld.RandGen.NextDouble() * GameWorld.RandGen.Next(-1, 2));
     Position = new Vector2(CollRectangle.X, CollRectangle.Y);
     Opacity = 1;
     color = Color.Red;
 }
开发者ID:DuckKnightDuel,项目名称:Adam,代码行数:12,代码来源:Particle.cs

示例8: CreateDeathSmoke

 public void CreateDeathSmoke(Entity entity)
 {
     CurrentParticle = ParticleType.DeathSmoke;
     Texture = ContentHelper.LoadTexture("Effects/smoke");
     CollRectangle = new Rectangle(GameWorld.RandGen.Next(entity.GetCollRectangle().X, entity.GetCollRectangle().Right - 16), GameWorld.RandGen.Next(entity.GetCollRectangle().Y, entity.GetCollRectangle().Bottom - 16), 16, 16);
     SourceRectangle = new Rectangle(GameWorld.RandGen.Next(0, 4) * 16, 0, 16, 16);
     Velocity.X = (float)(GameWorld.RandGen.NextDouble() * GameWorld.RandGen.Next(-2, 3));
     Velocity.Y = -.5f;
     Position = new Vector2(CollRectangle.X, CollRectangle.Y);
     Opacity = 2;
 }
开发者ID:DuckKnightDuel,项目名称:Adam,代码行数:11,代码来源:Particle.cs

示例9: MachineGunParticle

        public MachineGunParticle(Entity source, int xCoor)
        {
            SourceRectangle = new Rectangle(264, 96, 8, 8);
            Texture = GameWorld.SpriteSheet;
            CollRectangle = new Rectangle(source.GetCollRectangle().X + xCoor - 4, source.GetCollRectangle().Y + 4, 8, 8);
            Position = new Vector2(CollRectangle.X, CollRectangle.Y);
            Opacity = 1f;
            Velocity.Y = -8f;
            _hitSound = new SoundFx("Sounds/Machine Gun/bulletHit",this);

            light = new DynamicPointLight(this, .05f, false, Color.White, .5f);
            GameWorld.Instance.LightEngine.AddDynamicLight(light);
        }
开发者ID:DuckKnightDuel,项目名称:Adam,代码行数:13,代码来源:Particle.cs


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