Ejemplo n.º 1
0
        public bool Expand(CollisableArea anotherSection)
        {
            if (IsCollidingWith(anotherSection))
            {
                if (anotherSection.X < X)
                {
                    X = anotherSection.X;
                }

                if (anotherSection.Z < Z)
                {
                    Z = anotherSection.Z;
                }

                if (anotherSection.X2 > X2)
                {
                    X2 = anotherSection.X2;
                }

                if (anotherSection.Z2 < Z2)
                {
                    Z2 = anotherSection.Z2;
                }

                dX = X2 - X;
                dZ = Z2 - Z;


                return(true);
            }
            else
            {
                return(false);
            }
        }
        public bool TestAndMaybeAdd(CollisableArea TestingCollidingObject)
        {
            if (AreaCovered.IsCollidingWith(TestingCollidingObject))
            {
                Add(TestingCollidingObject);
                return(true);
            }

            return(false);
        }
 private void Add(CollisableArea PossibleCollidingObject)
 {
     AreaCovered.Expand(PossibleCollidingObject);
     PossibleCollisions.Add(PossibleCollidingObject);
     IsActive = true;
 }
 public PossibleCollisionsGroup(CollisableArea Area)
 {
     AreaCovered        = Area;
     PossibleCollisions = new List <CollisableArea>();
     PossibleCollisions.Add(Area);
 }
Ejemplo n.º 5
0
 public bool IsCollidingWith(CollisableArea anotherSection)
 {
     return
         ((X <= anotherSection.X2) && (anotherSection.X <= X2) &&
          (Z <= anotherSection.Z2) && (anotherSection.Z <= Z2));
 }