Ejemplo n.º 1
0
        public void Update(Vector2 entPos)
        {
            Center        = entPos + Offset;
            bounds.center = Center;

            Vector2      min = new Vector2(float.MaxValue, float.MaxValue);
            Vector2      max = new Vector2(float.MinValue, float.MinValue);
            ColliderBase curShape;

            for (int i = 0; i < CollisionShapes.Length; i++)
            {
                curShape = CollisionShapes[i];
                if (curShape.Min.y < min.y)
                {
                    min.y = curShape.Min.y;
                }

                if (curShape.Max.y > max.y)
                {
                    max.y = curShape.Max.y;
                }

                if (curShape.Min.x < min.x)
                {
                    min.x = curShape.Min.x;
                }

                if (curShape.Max.x > max.x)
                {
                    max.x = curShape.Max.x;
                }

                curShape.Update(Center);
            }

            bounds.UpdateFast(min, max);
        }