예제 #1
0
        public KnightClass()
        {
            collisionData = ResourceCache.Instance.GetCollisionMesh("knightHitMesh2.cm");
            List<MyVector> tempPoints = new List<MyVector>();
            for (int i = 0; i < collisionData.m_hardPoints.Length; i++)
            {
                if (collisionData.m_hardPoints[i].Y < 0)
                    tempPoints.Add(collisionData.m_hardPoints[i]);
            }
            collisionData.m_hardPoints = tempPoints.ToArray();
            walkingCollisionData = ResourceCache.Instance.GetCollisionMesh("knightWalkingPoint.cm");
            //hitMesh = ResourceCache.Instance.GetCollisionMesh("knightHitMesh.cm");
            //            renderingData = ResourceCache.Instance.GetRenderingData("knightStanding.x");
            Matrix rot = Matrix.RotationY((float)Math.PI);
            renderingData = ResourceCache.Instance.GetRenderingData("knightStanding.x");
            renderingData.CustomTransform = rot;
            rdWithCrossbow = ResourceCache.Instance.GetRenderingData("knightWithCrossbow.x");
            rdWithCrossbow.CustomTransform = rot;
            rdWithGrenade = ResourceCache.Instance.GetRenderingData("knightWithGrenade.x");
            rdWithGrenade.CustomTransform = rot;
            deadRd = ResourceCache.Instance.GetRenderingData("knightDead.x");

            float r = renderingData.BoundingSphereRadius;

            Matrix tr = Matrix.Translation(0, -3, 0);
            deadRd.CustomTransform = tr;
        }
예제 #2
0
 public StaticMesh(ICollisionData cdata, CollisionDataType cdataType, RenderingData rdata, MyVector position, MyVector rotation)
 {
     collisionDataType = cdataType;
     collisionData = cdata;
     renderingData = rdata;
     this.Position = position;
     this.Orientation = MyQuaternion.FromEulerAngles(rotation.X, rotation.Y, rotation.Z);
 }
예제 #3
0
 //StaticBodyData bodyData;
 public StaticMesh(ICollisionData cdata, CollisionDataType cdataType, RenderingData rdata, MyVector position)
 {
     collisionDataType = cdataType;
     collisionData = cdata;
     renderingData = rdata;
     this.Position = position;
     //bodyData.Orientation = MyQuaternion.FromEulerAngles(0, 0, 0);
     this.Orientation = MyQuaternion.FromEulerAngles(0, 0, 0);
 }
예제 #4
0
        public AssassinClass()
        {
            collisionData = ResourceCache.Instance.GetCollisionMesh("assassinHitMesh2.cm");
            List<MyVector> tempPoints = new List<MyVector>();
            for (int i = 0; i < collisionData.m_hardPoints.Length; i++)
            {
                if (collisionData.m_hardPoints[i].Y < 0)
                    tempPoints.Add(collisionData.m_hardPoints[i]);
            }
            collisionData.m_hardPoints = tempPoints.ToArray();
            walkingCollisionData = ResourceCache.Instance.GetCollisionMesh("assassinWalkingPoint.cm");
            //hitMesh = ResourceCache.Instance.GetCollisionMesh("assassinHitMesh.cm");

            //renderingData = ResourceCache.Instance.GetRenderingData("assassinWalkingMesh2.x");
            renderingData = ResourceCache.Instance.GetRenderingData("assassinWalkingMesh2.x");
            rdWithPipe = ResourceCache.Instance.GetRenderingData("assassinWithPipe.x");
            rdWithFireball = ResourceCache.Instance.GetRenderingData("assassinWithPipe.x");
            deadRd = ResourceCache.Instance.GetRenderingData("assassinDead.x");

            Matrix tr = Matrix.Translation(0, -4, 0);
            deadRd.CustomTransform = tr;
        }
예제 #5
0
        public void RenderRD(RenderingData rdata, Matrix world)
        {
            ShaderConstants.World = world;
            for (int i = 0; i < rdata.MeshMaterials.Length; i++)
            {

                if (i == 0 || (i > 0 && rdata.MeshMaterials[i - 1] != rdata.MeshMaterials[i]))
                {
                    if (i > 0)
                    {
                        currentEffect.DxEffect.EndPass();
                        currentEffect.DxEffect.End();
                    }
                    SetMaterial(rdata.MeshMaterials[i], rdata.MeshDxMaterials[i]);
                    ShaderConstants.SetEffectParameters(currentEffect.DxEffect, currentEffect.ParamHandles);
                    currentEffect.DxEffect.Begin(FX.None);
                    currentEffect.DxEffect.BeginPass(0);

                }
                rdata.DxMesh.DrawSubset(i);

            }
            currentEffect.DxEffect.EndPass();
            currentEffect.DxEffect.End();
        }
예제 #6
0
 public DeadCharacter(RenderingData rdata, MyVector position)
     : base(null, CollisionDataType.None, rdata, position)
 {
 }
예제 #7
0
        public static RenderingData FromFile(string fileName)
        {
            if (fileName.EndsWith("rd"))
            {
                XmlTextReader reader = new XmlTextReader(fileName);
                string result;
                RenderingData data;
                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element && reader.Name == "RenderingData")
                    {
                        data = new RenderingData();
                        result = reader.GetAttribute("type");
                        if (result == null)
                            throw new FileFormatException("Nie znaleziono typu danych w pliku " + fileName);

                        switch (result)
                        {
                            case "Mesh":
                                data.type = RenderingDataType.Mesh;
                                break;
                        }

                        if (data.type == RenderingDataType.Mesh)
                        {
                            while (reader.NodeType != XmlNodeType.EndElement)
                            {
                                reader.Read();
                                if (reader.Name == "Mesh")
                                {
                                    result = reader.GetAttribute("file");

                                    if (result == null)
                                        throw new FileFormatException("Nie znaleziono opisu broni w pliku " + fileName);
                                    data.meshFile = result;
                                    data.mesh = ResourceCache.Instance.GetMesh(result, out data.meshMaterials, out data.meshDxMaterials);

                                }

                            }
                        }
                        return data;
                    }
                }
                return null;
            }
            else
            {
                RenderingData data = new RenderingData();
                fileName = fileName.Substring(fileName.LastIndexOf('\\') + 1);
                data.mesh = ResourceCache.Instance.GetMesh(fileName, out data.meshMaterials, out data.meshDxMaterials);
                data.meshFile = fileName;
                data.type = RenderingDataType.Mesh;
                return data;

            }
        }