Exemple #1
0
        /// <summary>
        /// Takes an externally created PhysicalObject applies an object definition to it, then
        /// adds it to the group to be managed by this class.
        /// </summary>
        /// <param name="NewObj">Object to define and import</param>
        /// <param name="strDefName">Object definition to apply</param>
        /// <param name="nGroupID">Group to add this object to</param>
        public void ImportGameObject(PhysicalObject NewObj, string strDefName, Int32 nGroupID)
        {
            ApplyDefinition(NewObj, strDefName);

            //Add the object to all lists
            if (cObjGroups.ContainsKey(nGroupID) == false)               //New gorup, add the entry
            {
                cObjGroups.Add(nGroupID, new List <PhysicalObject>());
            }

            cObjGroups[nGroupID].Add(NewObj);

            return;
        }
Exemple #2
0
        /// <summary>
        /// Creates a new instance of PhysicalObject, applies the specified object definition,
        /// ands adds it to the suggested group to be managed by this class
        /// </summary>
        /// <param name="strDefName">Object definition name</param>
        /// <param name="nGroupID">Group to add this object to</param>
        /// <returns></returns>
        public PhysicalObject SpawnGameObject(string strDefName, Int32 nGroupID)
        {
            PhysicalObject NewObj;

            if (cObjDefsList.ContainsKey(strDefName) == false)
            {
                throw new Exception("No object definition with name '" + strDefName + "' exists in this manager");
            }

            //Create and initialize the object
            NewObj = new PhysicalObject(cGraphDev, cImageAtlas);

            ImportGameObject(NewObj, strDefName, nGroupID);

            return(NewObj);
        }
Exemple #3
0
        /// <summary>
        /// Applies an object definition to an externally created PhysicalObject only
        /// The object is not imported to a group and will not be managed by this class
        /// </summary>
        /// <param name="Obj">Object to apply a definition to</param>
        /// <param name="strDefName">Object definition name</param>
        public void ApplyDefinition(PhysicalObject Obj, string strDefName)
        {
            sObjectInfo_t ObjDef;

            if (cObjDefsList.ContainsKey(strDefName) == false)
            {
                throw new Exception("No object definition with name '" + strDefName + "' exists in this manager");
            }

            //Load the object definition
            ObjDef = cObjDefsList[strDefName];

            Obj.Width           = ObjDef.nWidth;
            Obj.Height          = ObjDef.nHeight;
            Obj.TextureName     = ObjDef.strTextureName;
            Obj.TextureRotation = ObjDef.nTextureRotate;
            Obj.SetCollisionVertexes(ObjDef.avVertexes);

            return;
        }
 public virtual void ReportCollision(GameTime CurrTime, PhysicalObject oCollider)
 {
     return;
 }