示例#1
0
 public void LoadModels(string pFile)
 {
     try
     {
         this.Models.Clear();
         DataSet dataSet = new DataSet();
         dataSet.ReadXml(pFile);
         DataTable dataTable = dataSet.Tables[0];
         if (dataTable.Rows.Count > 0)
         {
             foreach (DataRow dataRow in dataTable.Rows)
             {
                 string     pName       = (string)dataRow[0];
                 int        index       = Convert.ToInt32(dataRow[1]);
                 float      valueX      = CHelper.myToSingle((string)dataRow[2]);
                 float      valueY      = CHelper.myToSingle((string)dataRow[3]);
                 float      num         = CHelper.myToSingle((string)dataRow[4]);
                 float      pAngleZ     = CHelper.myToSingle((string)dataRow[5]);
                 CModelMesh pCModelMesh = this.ModelMeshs[index];
                 Vector3    position    = new Vector3(valueX, valueY, num);
                 CModel     cModel      = new CModel(pName, this.device, pCModelMesh, position, pAngleZ);
                 if (num == 0f)
                 {
                     cModel.Z = this.myTerrain.getZ(cModel.X, cModel.Y);
                 }
                 this.Models.Add(cModel);
             }
         }
     }
     catch
     {
     }
 }
示例#2
0
        public void Load1Model(string pName, int pModelIndex, Vector3 pPos, float dHeading)
        {
            CModelMesh pCModelMesh = this.m_ModelMeshs[pModelIndex];
            CModel     cModel      = new CModel(pName, this.device, pCModelMesh, pPos, dHeading);

            cModel.Z = this.myTerrain.getZ(cModel.X, cModel.Y);
            this.Models.Add(cModel);
        }
示例#3
0
 public CSpinTo(CThucHanh pThucHanh, string pName, CModel pObj, int start, int pduration, Vector3 ptopos, int pisound, bool loop) : base(pThucHanh)
 {
     this.Name           = pName;
     this.Obj            = pObj;
     this.StartTickCount = start;
     this.duration       = pduration;
     this.StopTickCount  = this.StartTickCount + this.duration;
     this.topos          = ptopos;
     this.isound         = pisound;
     this.soundloop      = loop;
 }
示例#4
0
 public CSpin(CThucHanh pThucHanh, string pName, CModel pObj, int start, int pduration, float pAngleZ, int pisound, bool loop) : base(pThucHanh)
 {
     this.Name           = pName;
     this.Obj            = pObj;
     this.StartTickCount = start;
     this.duration       = pduration;
     this.StopTickCount  = this.StartTickCount + this.duration;
     this.dAngleZ        = pAngleZ;
     this.rAngleZ        = Geometry.DegreeToRadian(this.dAngleZ);
     this.saveAngleZ     = this.Obj.angleZ;
     this.isound         = pisound;
     this.soundloop      = loop;
 }
示例#5
0
        public CModel GetModelByName(string name)
        {
            CModel result = null;

            if (this.Models.Count > 0)
            {
                for (int i = 0; i < this.Models.Count; i++)
                {
                    if (this.Models[i].Name.Length == name.Length && this.Models[i].Name.ToUpper() == name.ToUpper())
                    {
                        result = this.Models[i];
                        break;
                    }
                }
            }
            return(result);
        }