public void SetCharacter(CharacterProfile character) { if (character != null) { BlueQuad.IsVisible = isSelected; ItemLabel.Caption = " " + character.DisplayName; } else { BlueQuad.IsVisible = false; ItemLabel.Caption = ""; } }
//public List<GameObject> Contacts; //public Described PickingTarget; //public List<DescribedProfile> Inventory; //ItemSword _Sword; //Entity SwordEntity; //public CharacterAnimBlender AnimBlender; //public bool TalkPerm; //public bool InventoryPerm; //public bool PickItemOrder; //public bool MoveOrder; //public bool MoveOrderBack; //public bool GetSwordOrder; //public bool HideSwordOrder; //bool _RunOrder; /*public bool RunOrder * { * get * { * return _RunOrder; * } * set * { * if (_RunOrder == true && value == false) * { * _RunOrder = false; * Profile.WalkSpeed -= 2.0f; * } * if (_RunOrder == false && value == true) * { * _RunOrder = true; * Profile.WalkSpeed += 2.0f; * } * } * } * * public float TurnDelta; * * public bool FollowPathOrder; * public List<Vector3> WalkPath; * public static DecTree.Enemies.e_Node Tree = new EnemyDecTree(); * * * ////////////////////////////////////////////// * // Moje zmienne: * ////////////////////////////////////////////// * * Container Container; * public bool isContainer; * bool isSeen; * bool isReachable; * float ZasiegWzroku; * float ZasiegOgolny; * Prize DropPrize; * public Statistics Statistics;*/ public Enemy(CharacterProfile profile) { Profile = profile.Clone(); _Orientation = Quaternion.IDENTITY; Entity = Engine.Singleton.SceneManager.CreateEntity(Profile.MeshName); Node = Engine.Singleton.SceneManager.RootSceneNode.CreateChildSceneNode(); Node.AttachObject(Entity); // Vector3 scaledSize = Entity.BoundingBox.HalfSize * Profile.BodyScaleFactor; ConvexCollision collision = new MogreNewt.CollisionPrimitives.ConvexHull(Engine.Singleton.NewtonWorld, Node, Quaternion.IDENTITY, 0.1f, Engine.Singleton.GetUniqueBodyId()); Vector3 inertia, offset; collision.CalculateInertialMatrix(out inertia, out offset); Inertia = inertia; Body = new Body(Engine.Singleton.NewtonWorld, collision, true); Body.AttachNode(Node); Body.SetMassMatrix(Profile.BodyMass, inertia * Profile.BodyMass); //Body.AutoSleep = false; //Body.Transformed += BodyTransformCallback; Body.ForceCallback += BodyForceCallback; Body.UserData = this; Body.MaterialGroupID = Engine.Singleton.MaterialManager.CharacterMaterialID; //Joint upVector = new MogreNewt.BasicJoints.UpVector( // Engine.Singleton.NewtonWorld, Body, Vector3.UNIT_Y); collision.Dispose(); }
//public List<GameObject> Contacts; //public Described PickingTarget; //public List<DescribedProfile> Inventory; //ItemSword _Sword; //Entity SwordEntity; //public CharacterAnimBlender AnimBlender; //public bool TalkPerm; //public bool InventoryPerm; //public bool PickItemOrder; //public bool MoveOrder; //public bool MoveOrderBack; //public bool GetSwordOrder; //public bool HideSwordOrder; //bool _RunOrder; /*public bool RunOrder { get { return _RunOrder; } set { if (_RunOrder == true && value == false) { _RunOrder = false; Profile.WalkSpeed -= 2.0f; } if (_RunOrder == false && value == true) { _RunOrder = true; Profile.WalkSpeed += 2.0f; } } } public float TurnDelta; public bool FollowPathOrder; public List<Vector3> WalkPath; public static DecTree.Enemies.e_Node Tree = new EnemyDecTree(); ////////////////////////////////////////////// // Moje zmienne: ////////////////////////////////////////////// Container Container; public bool isContainer; bool isSeen; bool isReachable; float ZasiegWzroku; float ZasiegOgolny; Prize DropPrize; public Statistics Statistics;*/ public Enemy(CharacterProfile profile) { Profile = profile.Clone(); _Orientation = Quaternion.IDENTITY; Entity = Engine.Singleton.SceneManager.CreateEntity(Profile.MeshName); Node = Engine.Singleton.SceneManager.RootSceneNode.CreateChildSceneNode(); Node.AttachObject(Entity); // Vector3 scaledSize = Entity.BoundingBox.HalfSize * Profile.BodyScaleFactor; ConvexCollision collision = new MogreNewt.CollisionPrimitives.ConvexHull(Engine.Singleton.NewtonWorld, Node, Quaternion.IDENTITY, 0.1f, Engine.Singleton.GetUniqueBodyId()); Vector3 inertia, offset; collision.CalculateInertialMatrix(out inertia, out offset); Inertia = inertia; Body = new Body(Engine.Singleton.NewtonWorld, collision, true); Body.AttachNode(Node); Body.SetMassMatrix(Profile.BodyMass, inertia * Profile.BodyMass); //Body.AutoSleep = false; //Body.Transformed += BodyTransformCallback; Body.ForceCallback += BodyForceCallback; Body.UserData = this; Body.MaterialGroupID = Engine.Singleton.MaterialManager.CharacterMaterialID; //Joint upVector = new MogreNewt.BasicJoints.UpVector( // Engine.Singleton.NewtonWorld, Body, Vector3.UNIT_Y); collision.Dispose(); }
public CharacterProfileManager() { C = new Dictionary<String, CharacterProfile>(); E = new Dictionary<String, CharacterProfile>(); if (System.IO.File.Exists("Media\\Profiles\\NPCs.xml")) { XmlDocument File = new XmlDocument(); File.Load("Media\\Profiles\\NPCs.xml"); XmlElement root = File.DocumentElement; XmlNodeList Items = root.SelectNodes("//npcs//npc"); foreach (XmlNode item in Items) { CharacterProfile Kriper = new CharacterProfile(); Kriper.DisplayName = item["DisplayName"].InnerText; Kriper.MeshName = item["MeshName"].InnerText; Kriper.BodyMass = int.Parse(item["BodyMass"].InnerText); Kriper.WalkSpeed = float.Parse(item["WalkSpeed"].InnerText); Kriper.DisplayNameOffset = Vector3.ZERO; Kriper.DisplayNameOffset.x = float.Parse(item["DisplayNameOffset_x"].InnerText); Kriper.DisplayNameOffset.y = float.Parse(item["DisplayNameOffset_y"].InnerText); Kriper.DisplayNameOffset.z = float.Parse(item["DisplayNameOffset_z"].InnerText); Kriper.HeadOffset = Vector3.ZERO; Kriper.HeadOffset.x = float.Parse(item["HeadOffset_x"].InnerText); Kriper.HeadOffset.y = float.Parse(item["HeadOffset_y"].InnerText); Kriper.HeadOffset.z = float.Parse(item["HeadOffset_z"].InnerText); Kriper.ProfileName = item["ProfileName"].InnerText; //Kriper.FriendlyType = (Character.FriendType)int.Parse(item["FriendlyType"].InnerText); //Kriper.Statistics = new Statistics(int.Parse(item["WalkaWrecz"].InnerText), int.Parse(item["Sila"].InnerText), int.Parse(item["Opanowanie"].InnerText), int.Parse(item["Wytrzymalosc"].InnerText), int.Parse(item["Zrecznosc"].InnerText), int.Parse(item["Charyzma"].InnerText), int.Parse(item["Zywotnosc"].InnerText)); //Kriper.DialogRoot = item["DialogRoot"].InnerText; C.Add(Kriper.ProfileName, Kriper); } } if (System.IO.File.Exists("Media\\Profiles\\Enemies.xml")) { XmlDocument File = new XmlDocument(); File.Load("Media\\Profiles\\Enemies.xml"); XmlElement root = File.DocumentElement; XmlNodeList Items = root.SelectNodes("//enemies//enemy"); foreach (XmlNode item in Items) { CharacterProfile Kriper = new CharacterProfile(); Kriper.DisplayName = item["DisplayName"].InnerText; Kriper.MeshName = item["MeshName"].InnerText; Kriper.BodyMass = int.Parse(item["BodyMass"].InnerText); Kriper.WalkSpeed = float.Parse(item["WalkSpeed"].InnerText); Kriper.DisplayNameOffset = Vector3.ZERO; Kriper.DisplayNameOffset.x = float.Parse(item["DisplayNameOffset_x"].InnerText); Kriper.DisplayNameOffset.y = float.Parse(item["DisplayNameOffset_y"].InnerText); Kriper.DisplayNameOffset.z = float.Parse(item["DisplayNameOffset_z"].InnerText); Kriper.HeadOffset = Vector3.ZERO; Kriper.HeadOffset.x = float.Parse(item["HeadOffset_x"].InnerText); Kriper.HeadOffset.y = float.Parse(item["HeadOffset_y"].InnerText); Kriper.HeadOffset.z = float.Parse(item["HeadOffset_z"].InnerText); Kriper.ProfileName = item["ProfileName"].InnerText; //Kriper.FriendlyType = (Character.FriendType)int.Parse(item["FriendlyType"].InnerText); //Kriper.Statistics = new Statistics(int.Parse(item["WalkaWrecz"].InnerText), int.Parse(item["Sila"].InnerText), int.Parse(item["Opanowanie"].InnerText), int.Parse(item["Wytrzymalosc"].InnerText), int.Parse(item["Zrecznosc"].InnerText), int.Parse(item["Charyzma"].InnerText), int.Parse(item["Zywotnosc"].InnerText)); //Kriper.ZasiegOgolny = int.Parse(item["ZasiegOgolny"].InnerText); //Kriper.ZasiegWzroku = int.Parse(item["ZasiegWzroku"].InnerText); E.Add(item["ProfileName"].InnerText, Kriper); } } }
public CharacterProfileManager() { C = new Dictionary <String, CharacterProfile>(); E = new Dictionary <String, CharacterProfile>(); if (System.IO.File.Exists("Media\\Profiles\\NPCs.xml")) { XmlDocument File = new XmlDocument(); File.Load("Media\\Profiles\\NPCs.xml"); XmlElement root = File.DocumentElement; XmlNodeList Items = root.SelectNodes("//npcs//npc"); foreach (XmlNode item in Items) { CharacterProfile Kriper = new CharacterProfile(); Kriper.DisplayName = item["DisplayName"].InnerText; Kriper.MeshName = item["MeshName"].InnerText; Kriper.BodyMass = int.Parse(item["BodyMass"].InnerText); Kriper.WalkSpeed = float.Parse(item["WalkSpeed"].InnerText); Kriper.DisplayNameOffset = Vector3.ZERO; Kriper.DisplayNameOffset.x = float.Parse(item["DisplayNameOffset_x"].InnerText); Kriper.DisplayNameOffset.y = float.Parse(item["DisplayNameOffset_y"].InnerText); Kriper.DisplayNameOffset.z = float.Parse(item["DisplayNameOffset_z"].InnerText); Kriper.HeadOffset = Vector3.ZERO; Kriper.HeadOffset.x = float.Parse(item["HeadOffset_x"].InnerText); Kriper.HeadOffset.y = float.Parse(item["HeadOffset_y"].InnerText); Kriper.HeadOffset.z = float.Parse(item["HeadOffset_z"].InnerText); Kriper.ProfileName = item["ProfileName"].InnerText; //Kriper.FriendlyType = (Character.FriendType)int.Parse(item["FriendlyType"].InnerText); //Kriper.Statistics = new Statistics(int.Parse(item["WalkaWrecz"].InnerText), int.Parse(item["Sila"].InnerText), int.Parse(item["Opanowanie"].InnerText), int.Parse(item["Wytrzymalosc"].InnerText), int.Parse(item["Zrecznosc"].InnerText), int.Parse(item["Charyzma"].InnerText), int.Parse(item["Zywotnosc"].InnerText)); //Kriper.DialogRoot = item["DialogRoot"].InnerText; C.Add(Kriper.ProfileName, Kriper); } } if (System.IO.File.Exists("Media\\Profiles\\Enemies.xml")) { XmlDocument File = new XmlDocument(); File.Load("Media\\Profiles\\Enemies.xml"); XmlElement root = File.DocumentElement; XmlNodeList Items = root.SelectNodes("//enemies//enemy"); foreach (XmlNode item in Items) { CharacterProfile Kriper = new CharacterProfile(); Kriper.DisplayName = item["DisplayName"].InnerText; Kriper.MeshName = item["MeshName"].InnerText; Kriper.BodyMass = int.Parse(item["BodyMass"].InnerText); Kriper.WalkSpeed = float.Parse(item["WalkSpeed"].InnerText); Kriper.DisplayNameOffset = Vector3.ZERO; Kriper.DisplayNameOffset.x = float.Parse(item["DisplayNameOffset_x"].InnerText); Kriper.DisplayNameOffset.y = float.Parse(item["DisplayNameOffset_y"].InnerText); Kriper.DisplayNameOffset.z = float.Parse(item["DisplayNameOffset_z"].InnerText); Kriper.HeadOffset = Vector3.ZERO; Kriper.HeadOffset.x = float.Parse(item["HeadOffset_x"].InnerText); Kriper.HeadOffset.y = float.Parse(item["HeadOffset_y"].InnerText); Kriper.HeadOffset.z = float.Parse(item["HeadOffset_z"].InnerText); Kriper.ProfileName = item["ProfileName"].InnerText; //Kriper.FriendlyType = (Character.FriendType)int.Parse(item["FriendlyType"].InnerText); //Kriper.Statistics = new Statistics(int.Parse(item["WalkaWrecz"].InnerText), int.Parse(item["Sila"].InnerText), int.Parse(item["Opanowanie"].InnerText), int.Parse(item["Wytrzymalosc"].InnerText), int.Parse(item["Zrecznosc"].InnerText), int.Parse(item["Charyzma"].InnerText), int.Parse(item["Zywotnosc"].InnerText)); //Kriper.ZasiegOgolny = int.Parse(item["ZasiegOgolny"].InnerText); //Kriper.ZasiegWzroku = int.Parse(item["ZasiegWzroku"].InnerText); E.Add(item["ProfileName"].InnerText, Kriper); } } }