Exemplo n.º 1
0
        // test
        ///<summary>
        ///Returns any world object that is inside buildarea,
        ///used for instance by standard build if it's not looking for a WO to check that you're not building on a WO!
        ///</summary>
        internal WorldObject GetWorldObject(ref Rectangle a_buildArea)
        {
            foreach (WorldObject worldObject in m_worldObjects)
            {
                Rectangle f_woArea = MathGameHelper.GetAreaRectangle(ref worldObject.m_position, ref worldObject.m_size);
                //Intersect properly...
                if (MathGameHelper.RectanglesIntersects(ref a_buildArea, ref f_woArea))
                {
                    return(worldObject);
                }
            }

            return(null);
        }
Exemplo n.º 2
0
        ///<summary>
        ///Returns a world object of a specific type on a specific area!
        ///</summary>
        public WorldObject GetWorldObject(ref Rectangle a_buildArea, WorldObjectType a_type)
        {
            foreach (WorldObject worldObject in m_worldObjects)
            {
                Rectangle f_woArea = MathGameHelper.GetAreaRectangle(ref worldObject.m_position, ref worldObject.m_size);


                if (MathGameHelper.RectanglesIntersects(ref a_buildArea, ref f_woArea) && a_type == worldObject.m_type)
                {
                    if (worldObject.m_type == WorldObjectType.SoL)
                    {
                        if ((worldObject as SoL).m_taken)
                        {
                            return(null);
                        }
                    }

                    return(worldObject);
                }
            }

            return(null);
        }