Beispiel #1
0
        public bool CollideCheck <T, Exclude>() where T : Entity where Exclude : Entity
        {
#if DEBUG
            if (Scene == null)
            {
                throw new Exception("Can't collide check an Entity against tracked objects when it is not a member of a Scene");
            }
            else if (!Scene.Tracker.Entities.ContainsKey(typeof(T)))
            {
                throw new Exception("Can't collide check an Entity against an untracked Entity type");
            }
            else if (!Scene.Tracker.Entities.ContainsKey(typeof(Exclude)))
            {
                throw new Exception("Excluded type is an untracked Entity type!");
            }
#endif

            var exclude = Scene.Tracker.Entities[typeof(Exclude)];
            foreach (var e in Scene.Tracker.Entities[typeof(T)])
            {
                if (!exclude.Contains(e))
                {
                    if (Collide.Check(this, e))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Beispiel #2
0
        public bool CollideCheck(BitTag tag, Vector2 at)
        {
#if DEBUG
            if (Scene == null)
            {
                throw new Exception("Can't collide check an Entity against a tag list when it is not a member of a Scene");
            }
#endif
            return(Collide.Check(this, Scene[tag], at));
        }
Beispiel #3
0
        public bool CollideCheck <T>() where T : Entity
        {
#if DEBUG
            if (Scene == null)
            {
                throw new Exception("Can't collide check an Entity against tracked Entities when it is not a member of a Scene");
            }
            else if (!Scene.Tracker.Entities.ContainsKey(typeof(T)))
            {
                throw new Exception("Can't collide check an Entity against an untracked Entity type");
            }
#endif

            return(Collide.Check(this, Scene.Tracker.Entities[typeof(T)]));
        }
Beispiel #4
0
        public Entity CollideFirstOutside(BitTag tag, Vector2 at)
        {
#if DEBUG
            if (Scene == null)
            {
                throw new Exception("Can't collide check an Entity against a tag list when it is not a member of a Scene");
            }
#endif

            foreach (var entity in Scene[tag])
            {
                if (!Collide.Check(this, entity) && Collide.Check(this, entity, at))
                {
                    return(entity);
                }
            }
            return(null);
        }
Beispiel #5
0
        public T CollideFirstOutsideByComponent <T>(Vector2 at) where T : CollidableComponent
        {
#if DEBUG
            if (Scene == null)
            {
                throw new Exception("Can't collide check an Entity against tracked CollidableComponents when it is not a member of a Scene");
            }
            else if (!Scene.Tracker.CollidableComponents.ContainsKey(typeof(T)))
            {
                throw new Exception("Can't collide check an Entity against an untracked CollidableComponent type");
            }
#endif

            foreach (var component in Scene.Tracker.CollidableComponents[typeof(T)])
            {
                if (!Collide.Check(this, component) && Collide.Check(this, component, at))
                {
                    return(component as T);
                }
            }
            return(null);
        }
Beispiel #6
0
        public T CollideFirstOutside <T>(Vector2 at) where T : Entity
        {
#if DEBUG
            if (Scene == null)
            {
                throw new Exception("Can't collide check an Entity against tracked Entities when it is not a member of a Scene");
            }
            else if (!Scene.Tracker.Entities.ContainsKey(typeof(T)))
            {
                throw new Exception("Can't collide check an Entity against an untracked Entity type");
            }
#endif

            foreach (var entity in Scene.Tracker.Entities[typeof(T)])
            {
                if (!Collide.Check(this, entity) && Collide.Check(this, entity, at))
                {
                    return(entity as T);
                }
            }
            return(null);
        }
Beispiel #7
0
        public bool CollideCheckByComponent <T>() where T : CollidableComponent
        {
#if DEBUG
            if (Scene == null)
            {
                throw new Exception("Can't collide check an Entity against tracked CollidableComponents when it is not a member of a Scene");
            }
            else if (!Scene.Tracker.Components.ContainsKey(typeof(T)))
            {
                throw new Exception("Can't collide check an Entity against an untracked CollidableComponent type");
            }
#endif

            foreach (var c in Scene.Tracker.CollidableComponents[typeof(T)])
            {
                if (Collide.Check(this, c))
                {
                    return(true);
                }
            }
            return(false);
        }
Beispiel #8
0
        public List <T> CollideAllByComponent <T>() where T : CollidableComponent
        {
#if DEBUG
            if (Scene == null)
            {
                throw new Exception("Can't collide check an Entity against tracked CollidableComponents when it is not a member of a Scene");
            }
            else if (!Scene.Tracker.CollidableComponents.ContainsKey(typeof(T)))
            {
                throw new Exception("Can't collide check an Entity against an untracked CollidableComponent type");
            }
#endif

            List <T> list = new List <T>();
            foreach (var component in Scene.Tracker.CollidableComponents[typeof(T)])
            {
                if (Collide.Check(this, component))
                {
                    list.Add(component as T);
                }
            }
            return(list);
        }
Beispiel #9
0
 public bool CollideCheckOutside(Entity other, Vector2 at)
 {
     return(!Collide.Check(this, other) && Collide.Check(this, other, at));
 }
Beispiel #10
0
 public bool CollideCheck <T>(Vector2 at) where T : Entity
 {
     return(Collide.Check(this, Scene.Tracker.Entities[typeof(T)], at));
 }
Beispiel #11
0
 public bool CollideCheck(CollidableComponent other, Vector2 at)
 {
     return(Collide.Check(this, other, at));
 }
Beispiel #12
0
 public bool CollideCheck(CollidableComponent other)
 {
     return(Collide.Check(this, other));
 }
Beispiel #13
0
 public bool CollideCheck(Entity other, Vector2 at)
 {
     return(Collide.Check(this, other, at));
 }
Beispiel #14
0
 public bool CollideCheck(Entity other)
 {
     return(Collide.Check(this, other));
 }