public override int UserAABBOverlap(ContactMaterial material, Body body0, Body body1, int threadIndex)
            {
                Vector3[] contactPoints;
                Vector3[] contactNormals;
                float[]   contactPenetration;

                if (MogreNewt.CollisionTool.CollisionCollide(
                        Engine.Singleton.NewtonWorld,
                        2,
                        body0.Collision,
                        body0.Orientation,
                        body0.Position,
                        body1.Collision,
                        body1.Orientation,
                        body1.Position,
                        out contactPoints,
                        out contactNormals,
                        out contactPenetration,
                        threadIndex) != 0)
                {
                    if (body0.UserData is TriggerVolume)
                    {
                        TriggerVolume triggerVolume = body0.UserData as TriggerVolume;
                        triggerVolume.HandleGameObject((Character)body1.UserData);
                    }
                    else
                    {
                        TriggerVolume triggerVolume = body1.UserData as TriggerVolume;
                        triggerVolume.HandleGameObject((Character)body0.UserData);
                    }
                }
                return(0);
            }
Example #2
0
 public void Activator_Left(TriggerVolume sender, Character character)
 {
     if (LeftActivator != "")
     {
         Method2.Invoke(Instance2, null);
     }
 }
Example #3
0
        public void Load()
        {
            if (File.Exists("Media\\Maps\\" + Engine.Singleton.CurrentLevel.Name + "\\Triggers.xml"))
            {
                XmlDocument Filee = new XmlDocument();
                Filee.Load("Media\\Maps\\" + Engine.Singleton.CurrentLevel.Name + "\\Triggers.xml");

                XmlElement  root  = Filee.DocumentElement;
                XmlNodeList Items = root.SelectNodes("//Triggers/Trigger");

                foreach (XmlNode item in Items)
                {
                    TriggerVolume newTrigg = new TriggerVolume();
                    newTrigg.ID             = item["ID"].InnerText;
                    newTrigg.EnterActivator = item["EnteredActivator"].InnerText;
                    newTrigg.LeftActivator  = item["LeftActivator"].InnerText;

                    float Size = float.Parse(item["Size"].InnerText);

                    newTrigg.BeginShapeBuild();
                    newTrigg.AddBoxPart(Vector3.ZERO, Quaternion.IDENTITY, new Vector3(Size, Size, Size));
                    newTrigg.EndShapeBuild();

                    newTrigg.Position = new Vector3(float.Parse(item["Position_x"].InnerText), float.Parse(item["Position_y"].InnerText), float.Parse(item["Position_z"].InnerText));

                    newTrigg.PrzypiszMetody();

                    T.Add(newTrigg.ID, newTrigg);
                    Engine.Singleton.ObjectManager.Add(newTrigg);
                }
            }
        }
Example #4
0
 public void Activator_Entered(TriggerVolume sender, Character character)
 {
     if (EnterActivator != "")
     {
         Method.Invoke(Instance, null);
     }
 }