Esempio n. 1
0
        //Create new point/plane extending to target
        public CollisionLink Branch(Vector2 point)
        {
            CollisionLink  link  = new CollisionLink(_parent, point);
            CollisionPlane plane = new CollisionPlane(_parent, this, link);

            return(link);
        }
Esempio n. 2
0
        public CollisionLink Split(Vector2 point)
        {
            CollisionLink  link  = new CollisionLink(_parent, point);
            CollisionPlane plane = new CollisionPlane(_parent, link, _linkRight);

            LinkRight = link;
            return(link);
        }
Esempio n. 3
0
 public void RemoveMember(CollisionPlane plane)
 {
     _members.Remove(plane);
     if (_members.Count == 0)
     {
         _parent._points.Remove(this);
     }
 }
        public CollisionLink Split(Vector2 point)
        {
            CollisionLink  link  = new CollisionLink(_parent, point);
            CollisionPlane plane = new CollisionPlane(_parent, link, _linkRight);

            plane._material = _material;
            plane._flags    = _flags;
            plane._flags2   = _flags2;
            plane._type     = _type;
            if (IsRightLedge)
            {
                IsRightLedge = false;
            }
            if (IsLeftLedge)
            {
                plane.IsLeftLedge = false;
            }
            LinkRight = link;
            return(link);
        }
Esempio n. 5
0
        internal unsafe void DrawPlanes(CollisionPlane p)
        {
            if (!_render)
            {
                return;
            }

            Color4  clr = new Color4(1.0f, 0.0f, 1.0f, 1.0f);
            Vector2 l   = _linkLeft.Value;
            Vector2 r   = _linkRight.Value;

            int lev = 0;

            if (_linkLeft._highlight)
            {
                lev++;
            }
            if (_linkRight._highlight)
            {
                lev++;
            }

            if (lev == 1)
            {
                GL.Color4(1.0f, 0.5f, 0.5f, 0.8f);
            }
            else
            {
                GL.Color4(0.9f, 0.0f, 0.9f, 0.8f);
            }

            if (p._type == CollisionPlaneType.Floor && lev == 0 && !IsFallThrough)
            {
                GL.Color4(0.0f, 0.9f, 0.9f, 0.8f);
            }
            else if (p._type == CollisionPlaneType.Ceiling && lev == 0 && !IsFallThrough)
            {
                GL.Color4(0.9f, 0.0f, 0.0f, 0.8f);
            }
            else if (p._type == CollisionPlaneType.LeftWall && lev == 0 && !IsFallThrough)
            {
                GL.Color4(0.0f, 0.9f, 0.0f, 0.8f);
            }
            else if (p._type == CollisionPlaneType.RightWall && lev == 0 && !IsFallThrough)
            {
                GL.Color4(0.0f, 0.9f, 0.0f, 0.8f);
            }
            else if (p._type == CollisionPlaneType.None && lev == 0 && !IsFallThrough)
            {
                GL.Color4(1.0f, 1.0f, 1.0f, 0.6f);
            }
            else if (p.IsFallThrough && lev == 0)
            {
                GL.Color4(1.0f, 1.0f, 0.0f, 0.8f);
            }

            GL.Begin(BeginMode.Quads);
            GL.Vertex3(l._x, l._y, 10.0f);
            GL.Vertex3(l._x, l._y, -10.0f);
            GL.Vertex3(r._x, r._y, -10.0f);
            GL.Vertex3(r._x, r._y, 10.0f);
            GL.End();

            if (lev == 1)
            {
                GL.Color4(0.7f, 0.2f, 0.2f, 0.8f);
            }
            else
            {
                GL.Color4(0.6f, 0.0f, 0.6f, 0.8f);
            }

            if (p._type == CollisionPlaneType.Floor && lev == 0 && !IsFallThrough)
            {
                GL.Color4(0.0f, 0.9f, 0.9f, 0.8f);
            }
            else if (p._type == CollisionPlaneType.Ceiling && lev == 0 && !IsFallThrough)
            {
                GL.Color4(0.9f, 0.0f, 0.0f, 0.8f);
            }
            else if (p._type == CollisionPlaneType.LeftWall && lev == 0 && !IsFallThrough)
            {
                GL.Color4(0.0f, 0.9f, 0.0f, 0.8f);
            }
            else if (p._type == CollisionPlaneType.RightWall && lev == 0 && !IsFallThrough)
            {
                GL.Color4(0.0f, 0.9f, 0.0f, 0.8f);
            }
            else if (p._type == CollisionPlaneType.None && lev == 0 && !IsFallThrough)
            {
                GL.Color4(1.0f, 1.0f, 1.0f, 0.6f);
            }
            else if (p.IsFallThrough && lev == 0)
            {
                GL.Color4(1.0f, 1.0f, 0.0f, 0.8f);
            }

            GL.Begin(BeginMode.Lines);
            GL.Vertex3(l._x, l._y, 10.0f);
            GL.Vertex3(r._x, r._y, 10.0f);
            GL.Vertex3(l._x, l._y, -10.0f);
            GL.Vertex3(r._x, r._y, -10.0f);
            GL.End();

            if (p.IsRightLedge && p.IsLeftLedge)
            {
                _linkLeft.Render(clr, 3.0f); _linkRight.Render(clr, 3.0f);
            }
            else if (p.IsLeftLedge && !p.IsRightLedge)
            {
                _linkLeft.Render(clr, 3.0f); _linkRight.Render();
            }
            else if (p.IsRightLedge && !p.IsLeftLedge)
            {
                _linkLeft.Render(); _linkRight.Render(clr, 3.0f);
            }
            else
            {
                _linkLeft.Render();
                _linkRight.Render();
            }
        }
 //Create new point/plane extending to target
 public CollisionLink Branch(Vector2 point)
 {
     CollisionLink link = new CollisionLink(_parent, point);
     CollisionPlane plane = new CollisionPlane(_parent, this, link);
     return link;
 }
 public CollisionLink Split(Vector2 point)
 {
     CollisionLink link = new CollisionLink(_parent, point);
     CollisionPlane plane = new CollisionPlane(_parent, link, _linkRight);
     LinkRight = link;
     return link;
 }
 public void RemoveMember(CollisionPlane plane)
 {
     _members.Remove(plane);
     if (_members.Count == 0)
         _parent._points.Remove(this);
 }