Exemple #1
0
 private void ManipulateAddingCatchableRopes()
 {
     if (mouseState.LeftButton == ButtonState.Pressed)
     {
         if (_catchableRope == null)
         {
             _catchableRope = AddCatchableRopesToEngine();
         }
     }
     else
     {
         if (_catchableRope != null && mouseState.LeftButton == ButtonState.Released)
         {
             _catchableRope = null;
         }
     }
 }
        public override void AddSelfToEngine()
        {
            int nrOfMasses = (length / 15) - 1;

            if (nrOfMasses <= 0)
            {
                nrOfMasses = 2;
            }
            CatchableRopeService rope = DefaultAdder.GetDefaultCatchableRope(new Vector3(X, Y, 0),
                                                                             StaticData.EngineManager.CookieRB.PositionXNA,
                                                                             nrOfMasses, 30 * nrOfMasses,
                                                                             10f, 0.1f,
                                                                             RigidType.SphereRigid,
                                                                             new Vector3(5, 5, 0), false,
                                                                             SpringType.StrictRope);

            StaticData.EngineManager.SpringsManagerEngine.AddNewService(rope);
        }
Exemple #3
0
        private CatchableRopeService AddCatchableRopesToEngine()
        {
            int nrOfMasses = (70 / 15) - 1;

            if (nrOfMasses <= 0)
            {
                nrOfMasses = 2;
            }
            CatchableRopeService rope = DefaultAdder.GetDefaultCatchableRope(new Vector3(mouseState.X, mouseState.Y, 0),
                                                                             StaticData.EngineManager.CookieRB.PositionXNA,
                                                                             nrOfMasses, 80 * nrOfMasses,
                                                                             10f, 0.1f,
                                                                             RigidType.SphereRigid,
                                                                             new Vector3(5, 5, 0), false,
                                                                             SpringType.StrictRope);

            StaticData.EngineManager.SpringsManagerEngine.AddNewService(rope);
            return(rope);
        }
Exemple #4
0
        public static CatchableRopeService GetDefaultCatchableRope(Vector3 initialPosition,
                                                                   Vector3?targetPos,
                                                                   int nrOfMasses,
                                                                   float springConstant,
                                                                   float normalLength,
                                                                   float springInnerFriction,
                                                                   RigidType type,
                                                                   Vector3 rigidSize,
                                                                   bool isCollidable,
                                                                   SpringType springType)
        {
            //List<RigidBody> masses = GetMassesRope(nrOfMasses, initialPosition, targetPos, rigidSize, normalLength, type, isCollidable);
            CatchableRopeService springService = new CatchableRopeService(nrOfMasses, initialPosition, springConstant, // springConstant In The Rope
                                                                          normalLength,                                // Normal Length Of Springs In The Rope
                                                                          springInnerFriction,                         // Spring Inner Friction Constant
                                                                          isCollidable,
                                                                          rigidSize,
                                                                          springType,
                                                                          type);

            return(springService);
        }