Example #1
0
 public Crouch()
 {
     m_ForwardForce = 12;
     m_ForwardForceBoost = 16;
     m_name = "crouch";
     m_collision = new MogreNewt.CollisionPrimitives.Capsule(
         Core.Singleton.NewtonWorld,
         0.25f,
         0.5f,
         Mogre.Vector3.UNIT_X.GetRotationTo(Mogre.Vector3.UNIT_Y),
         Core.Singleton.GetUniqueBodyId());
 }
Example #2
0
 public Fly()
 {
     m_name = "fly";
     m_ForwardForce = 0;
     m_ForwardForceBoost = 0;
     m_ForceStop = 0;//nie zatzrymuj go w powietrzu
     //lekki opór powietrza
     m_LinearDampingValue = 0.3f;
     m_collision = new MogreNewt.CollisionPrimitives.Capsule(
         Core.Singleton.NewtonWorld,
         0.30f,
         1.25f,
         Mogre.Vector3.UNIT_X.GetRotationTo(Mogre.Vector3.UNIT_Y),
         Core.Singleton.GetUniqueBodyId());
 }
Example #3
0
        public Character(CharacterProfile profile)
        {
            m_Profile = profile.Clone();

            m_Orientation = Quaternion.IDENTITY;

            m_Entity = Core.Singleton.m_SceneManager.CreateEntity(m_Profile.m_MeshName);
            m_Node = Core.Singleton.m_SceneManager.RootSceneNode.CreateChildSceneNode();
            m_Node.AttachObject(m_Entity);

            Vector3 scaledSize = m_Entity.BoundingBox.HalfSize * m_Profile.m_BodyScaleFactor;

            ConvexCollision collision = new MogreNewt.CollisionPrimitives.Capsule(
                Core.Singleton.m_NewtonWorld,
                System.Math.Min(scaledSize.x, scaledSize.z),
                scaledSize.y * 2,
                Vector3.UNIT_X.GetRotationTo(Vector3.UNIT_Y),
                Core.Singleton.GetUniqueBodyId());

            Vector3 inertia, offset;
            collision.CalculateInertialMatrix(out inertia, out offset);
            inertia *= m_Profile.m_BodyMass;

            m_Body = new Body(Core.Singleton.m_NewtonWorld, collision, true);
            m_Body.AttachNode(m_Node);
            m_Body.SetMassMatrix(m_Profile.m_BodyMass, inertia);
            m_Body.AutoSleep = false;

            m_Body.Transformed += BodyTransformCallback;
            m_Body.ForceCallback += BodyForceCallback;

            Joint upVector = new MogreNewt.BasicJoints.UpVector(
            Core.Singleton.m_NewtonWorld, m_Body, Vector3.UNIT_Y);

            collision.Dispose();
        }
Example #4
0
        public Character(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.Capsule(
                Engine.Singleton.NewtonWorld,
                System.Math.Min(scaledSize.x, scaledSize.z),
                scaledSize.y * 2,
                Vector3.UNIT_X.GetRotationTo(Vector3.UNIT_Y),
                Engine.Singleton.GetUniqueBodyId());



            Vector3 inertia, offset;

            collision.CalculateInertialMatrix(out inertia, out offset);

            inertia *= Profile.BodyMass;

            Body = new Body(Engine.Singleton.NewtonWorld, collision, true);
            Body.AttachNode(Node);
            Body.SetMassMatrix(Profile.BodyMass, inertia);
            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();

            SensorNode = Node.CreateChildSceneNode(new Vector3(0, 0, System.Math.Min(scaledSize.x, scaledSize.z) * 1.5f));

            collision = new MogreNewt.CollisionPrimitives.Cylinder(
                Engine.Singleton.NewtonWorld,
                System.Math.Min(scaledSize.x, scaledSize.z) * 1.5f,
                scaledSize.y * 1,
                Vector3.UNIT_X.GetRotationTo(Vector3.UNIT_Y),
                Engine.Singleton.GetUniqueBodyId());
            ObjectSensor = new Body(Engine.Singleton.NewtonWorld, collision, true);
            ObjectSensor.SetMassMatrix(1, new Vector3(1, 1, 1));

            ObjectSensor.UserData        = this;
            ObjectSensor.MaterialGroupID = Engine.Singleton.MaterialManager.CharacterSensorMaterialID;

            Contacts = new List <GameObject>();

            Inventory = new List <DescribedProfile>();
            Inventory = Profile.Inventory;

            AnimBlender = new CharacterAnimBlender();
            AnimBlender.SetEntity(Entity);

            ActiveQuests = new QuestManager();

            _Statistics = Profile.Statistics.statistics_Clone();

            FriendlyType = Profile.FriendlyType;

            State = Enemy.StateTypes.IDLE;

            DropExp  = 0;
            ProfName = Profile.ProfileName;

            if (Profile.DialogRoot != null && Profile.DialogRoot != "")
            {
                TalkRoot = Conversations.D[Profile.DialogRoot].Reactions.Values.ElementAt(0);
            }

            Activities = new ActivityManager();
            Waiting    = false;
        }
Example #5
0
        public Normal()
        {
            m_name = "normal";
            m_ForwardForce = 20;
            m_ForwardForceBoost = 40;

            m_collision = new MogreNewt.CollisionPrimitives.Capsule(
                Core.Singleton.NewtonWorld,
                0.30f,
                1.25f,
                Mogre.Vector3.UNIT_X.GetRotationTo(Mogre.Vector3.UNIT_Y),
                Core.Singleton.GetUniqueBodyId());
        }