Esempio n. 1
0
        public Player()
        {
            Camera = new GameCamera();

            Mysz          = new MOIS.MouseState_NativePtr();
            InventoryItem = null;
        }
        public Described(DescribedProfile profile)
        {
            Profile   = profile.Clone();
            Activator = "";
            Entity    = Engine.Singleton.SceneManager.CreateEntity(Profile.MeshName);
            Node      = Engine.Singleton.SceneManager.RootSceneNode.CreateChildSceneNode();

            Entity.CastShadows = true;
            Node.AttachObject(Entity);



            ConvexCollision coll = new MogreNewt.CollisionPrimitives.ConvexHull(Engine.Singleton.NewtonWorld,
                                                                                Node,
                                                                                Quaternion.IDENTITY,
                                                                                0.1f,
                                                                                Engine.Singleton.GetUniqueBodyId());

            Vector3 inertia = new Vector3(1, 1, 1), offset;

            coll.CalculateInertialMatrix(out inertia, out offset);

            Inertia = inertia;
            Body    = new Body(Engine.Singleton.NewtonWorld, coll, true);
            Body.AttachNode(Node);
            Body.SetMassMatrix(Profile.Mass, Profile.Mass * inertia);

            Body.MaterialGroupID = Engine.Singleton.MaterialManager.DescribedMaterialID;
            Body.UserData        = this;

            coll.Dispose();

            Body.ForceCallback += BodyForceCallback;
        }
Esempio n. 3
0
 public void SetItem(DescribedProfile item)
 {
     if (item != null)
     {
         BlueQuad.IsVisible = isSelected;
         ItemLabel.Caption  = "  " + item.DisplayName;
     }
     else
     {
         BlueQuad.IsVisible = false;
         ItemLabel.Caption  = "";
     }
 }
Esempio n. 4
0
        public Items()
        {
            I = new Dictionary <string, DescribedProfile>();

            XmlDocument File = new XmlDocument();

            File.Load("Media\\Profiles\\Items.xml");

            XmlElement  root  = File.DocumentElement;
            XmlNodeList Items = root.SelectNodes("//items/item");

            foreach (XmlNode item in Items)
            {
                if (item["type"].InnerText == "DescribedProfile")
                {
                    DescribedProfile Kriper = new DescribedProfile();
                    Kriper.DisplayName = item["name"].InnerText;
                    Kriper.Description = item["description"].InnerText;
                    Kriper.MeshName    = item["mesh"].InnerText;
                    Kriper.InventoryPictureMaterial = item["inventory_material"].InnerText;
                    Kriper.Mass                = int.Parse(item["mass"].InnerText);
                    Kriper.IsPickable          = bool.Parse(item["ispickable"].InnerText);
                    Kriper.DisplayNameOffset   = Vector3.ZERO;
                    Kriper.DisplayNameOffset.x = float.Parse(item["nameoffsetx"].InnerText);
                    Kriper.DisplayNameOffset.y = float.Parse(item["nameoffsety"].InnerText);
                    Kriper.DisplayNameOffset.z = float.Parse(item["nameoffsetz"].InnerText);
                    Kriper.ProfileName         = item["idstring"].InnerText;

                    I.Add(item["idstring"].InnerText, Kriper);
                }
                else if (item["type"].InnerText == "ItemSword")
                {
                    ItemSword Kriper = new ItemSword();
                    Kriper.DisplayName = item["name"].InnerText;
                    Kriper.Description = item["description"].InnerText;
                    Kriper.MeshName    = item["mesh"].InnerText;
                    Kriper.InventoryPictureMaterial = item["inventory_material"].InnerText;
                    Kriper.Mass                = int.Parse(item["mass"].InnerText);
                    Kriper.IsPickable          = bool.Parse(item["ispickable"].InnerText);
                    Kriper.DisplayNameOffset   = Vector3.ZERO;
                    Kriper.DisplayNameOffset.x = float.Parse(item["nameoffsetx"].InnerText);
                    Kriper.DisplayNameOffset.y = float.Parse(item["nameoffsety"].InnerText);
                    Kriper.DisplayNameOffset.z = float.Parse(item["nameoffsetz"].InnerText);
                    Kriper.ProfileName         = item["idstring"].InnerText;

                    I.Add(item["idstring"].InnerText, Kriper);
                }
            }
        }