Exemple #1
0
        public bool checkCollisionWithGround(Entity.Entity entity)
        {
            TileData first  = world.getTile(new Location(world, entity.DrawingArea.Left, entity.DrawingArea.Bottom));
            TileData second = world.getTile(new Location(world, entity.DrawingArea.Right, entity.DrawingArea.Bottom));

            return(!first.isEmpty || !second.isEmpty);
        }
Exemple #2
0
 public Camera2D(RabbitPlatform instance)
 {
     this.game   = instance;
     translation = new Vector3(0, 0, 0);
     followed    = null;
     cameraLimit = null;
 }
Exemple #3
0
        public bool checkRoundCenter(Entity.Entity entity1, Location location, float factor)
        {
            float radius1  = entity1.Location.getDistance(entity1.Center) * factor,
                  distance = entity1.Center.getDistance(location);

            return(distance - radius1 < 0);
        }
Exemple #4
0
        public bool checkRoundCenter(Entity.Entity entity1, Entity.Entity entity2, float factor)
        {
            float radius1  = entity1.Location.getDistance(entity1.Center) * factor,
                  radius2  = entity2.Location.getDistance(entity2.Center) * factor,
                  distance = entity1.Center.getDistance(entity2.Center);

            return(distance - radius1 - radius2 < 0);
        }
Exemple #5
0
        public bool checkRoundArea(Location location, Entity.Entity entity)
        {
            Location vertice  = new Location(world, entity.CollisionArea.X, entity.CollisionArea.Y);
            Location center   = new Location(world, entity.CollisionArea.X + entity.CollisionArea.Width, entity.CollisionArea.Y + entity.CollisionArea.Height);
            float    radius   = vertice.getDistance(center),
                     distance = center.getDistance(location);

            return(distance - radius < 0);
        }
Exemple #6
0
        public bool checkPerfect(Entity.Entity entity1, Entity.Entity entity2)
        {
            if (entity2.CollisionArea.Intersects(entity2.CollisionArea))
            {
                return(Mask.Intersects(entity1.Location, entity1.Mask, entity2.Location, entity2.Mask, entity1.IsFlipped, entity2.IsFlipped));
            }

            return(false);
        }
Exemple #7
0
        public float evalRoundArea(Entity.Entity entity1, Entity.Entity entity2)
        {
            Location vertice1 = new Location(world, entity1.CollisionArea.X, entity1.CollisionArea.Y),
                     vertice2 = new Location(world, entity2.CollisionArea.X, entity2.CollisionArea.Y);
            Location center1  = new Location(world, entity1.CollisionArea.X + entity1.CollisionArea.Width / 2, entity1.CollisionArea.Y + entity1.CollisionArea.Height / 2),
                     center2  = new Location(world, entity2.CollisionArea.X + entity2.CollisionArea.Width / 2, entity2.CollisionArea.Y + entity2.CollisionArea.Height / 2);
            float radius1     = vertice1.getDistance(center1),
                  radius2     = vertice2.getDistance(center2),
                  distance    = center1.getDistance(center2);

            return(distance - radius1 - radius2);
        }
Exemple #8
0
        public static EntityStaticMask fromTexture(Entity.Entity entity, Texture2D texture)
        {
            EntityStaticMask mask = new EntityStaticMask(entity);

            Color[] colors = new Color[mask.width * mask.height];
            texture.GetData <Color>(colors);

            for (int y = 0; y < mask.height; y++)
            {
                for (int x = 0; x < mask.width; x++)
                {
                    if (colors[x + y * mask.width] == Color.Black)
                    {
                        mask.mask[x + y * mask.width] = 1;
                    }
                }
            }

            return(mask);
        }
Exemple #9
0
 public void followEntity(Entity.Entity entity)
 {
     this.followed = entity;
 }
Exemple #10
0
 public bool checkRoundArea(Entity.Entity entity1, Entity.Entity entity2)
 {
     return(evalRoundArea(entity1, entity2) < 0);
 }
Exemple #11
0
 public void goTo(Entity.Entity entity)
 {
     findEntity = entity;
     findpath   = true;
 }
Exemple #12
0
 public PathFinder(Entity.Entity entity)
 {
     this.entity     = entity;
     this.findEntity = null;
     this.findpath   = false;
 }
Exemple #13
0
 public EntityStaticMask(Entity.Entity entity)
     : base(entity)
 {
 }
Exemple #14
0
 protected EntityMask(Entity.Entity entity)
     : base(entity.DrawingArea.Width, entity.DrawingArea.Height)
 {
     this.entity = entity;
 }
Exemple #15
0
 public EntityDynamicMask(Entity.Entity entity)
     : base(entity)
 {
     buf = null;
 }
Exemple #16
0
 public bool checkMouseOver(Entity.Entity entity)
 {
     return(checkLocationOver(world.InputManager.MouseLocation, entity));
 }
Exemple #17
0
 public bool checkLocationOver(Location location, Entity.Entity entity)
 {
     return(entity.DrawingArea.Contains(location.iX, location.iY));
 }
Exemple #18
0
 public bool check(Entity.Entity entity1, Entity.Entity entity2)
 {
     return(checkRoundArea(entity1, entity2));
 }
Exemple #19
0
 public bool checkRectArea(Entity.Entity entity1, Entity.Entity entity2)
 {
     return(entity1.CollisionArea.Intersects(entity1.CollisionArea));
 }
Exemple #20
0
 public bool checkRectArea(Location location, Entity.Entity entity)
 {
     return(entity.CollisionArea.Intersects(new Microsoft.Xna.Framework.Rectangle(location.iX, location.iY, 1, 1)));
 }
Exemple #21
0
 public bool checkRectArea(int x, int y, Entity.Entity entity)
 {
     return(checkRectArea(new Location(world, x, y), entity));
 }