Exemplo n.º 1
0
 void bAddRope_Click(object sender, EventArgs e)
 {
     try
     {
         StaticData.ManipulationGameMode = ManipulationGameMode.AddRopesMode;
         int        nrOfMasses          = (int)UIControlsParser.GetFloat(tbNrOfMasses);
         float      springConstant      = UIControlsParser.GetFloat(tbSpringConstant);
         float      normalLength        = UIControlsParser.GetFloat(tbNormalLength);
         float      springInnerFriction = UIControlsParser.GetFloat(tbSpringInnerFriction);
         Vector3    initialPosition     = UIControlsParser.GetVector3(tbPositionRope);
         RigidType  rigidType           = (RigidType)UIControlsParser.GetIndexOfSelection(ddTypeRigidRope);
         Vector3    rigidSize           = UIControlsParser.GetVector3(tbRigidSizeRope);
         bool       isCollidable        = cbIsCollidableRope.Checked;
         SpringType type = (SpringType)UIControlsParser.GetIndexOfSelection(cbSpringType);
         if (rigidSize != Vector3.Zero)
         {
             StaticData.EngineManager.SpringsManagerEngine.AddNewService(
                 DefaultAdder.GetDefaultSpringRope(initialPosition,
                                                   StaticData.EngineManager.CookieRB.PositionXNA,
                                                   nrOfMasses,
                                                   springConstant,
                                                   normalLength,
                                                   springInnerFriction,
                                                   rigidType,
                                                   rigidSize,
                                                   isCollidable,
                                                   type));
         }
     }
     catch (Exception)
     {
     }
 }
Exemplo n.º 2
0
 private void bBubbleMode_Click(object sender, EventArgs e)
 {
     if ((int)UIControlsParser.GetFloat(tbBubbleDim) > 0)
     {
         StaticData.BubbleDimBubble      = (int)UIControlsParser.GetFloat(tbBubbleDim);
         StaticData.ManipulationGameMode = ManipulationGameMode.AddBubblesMode;
     }
 }
Exemplo n.º 3
0
 void bCutTheRope_Click(object sender, EventArgs e)
 {
     try
     {
         int ropeID = (int)UIControlsParser.GetFloat(tbRopeID);
         StaticData.EngineManager.SpringsManagerEngine.RemoveService(ropeID);
     }
     catch
     {
     }
 }
Exemplo n.º 4
0
 private void bHCCutTheRods_Click(object sender, EventArgs e)
 {
     try
     {
         int rodsId = (int)UIControlsParser.GetFloat(this.tbHCRodID);
         StaticData.EngineManager.RopeOfRodsManagerEngine.RemoveService(rodsId);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 5
0
        void bAddRigid_Click(object sender, EventArgs e)
        {
            int      index       = UIControlsParser.GetIndexOfSelection(ddTypeRigid);
            Vector3  positionXNA = UIControlsParser.GetVector3(tbPositionXNARigid);
            Material material    = UIControlsParser.GetMaterial(ddMaterialRigid);

            int     width    = (int)UIControlsParser.GetFloat(tbWidthRigid);
            int     height   = (int)UIControlsParser.GetFloat(tbHeightRigid);
            Vector3 halfSize = new Vector3((int)width / 2, (int)height / 2, 0);

            int     radius           = (int)UIControlsParser.GetFloat(tbRadiusRigid);
            Vector3 acc              = UIControlsParser.GetVector3(tbAccRigid);
            Vector3 initialForce     = UIControlsParser.GetVector3(tbForceRigid);
            Vector3 initialTorque    = UIControlsParser.GetVector3(tbTorqueRigid) * 100000;
            float   orientationValue = UIControlsParser.GetFloat(tbOrientationRigid);
            bool    obInertia        = UIControlsParser.GetBool(ddInertiaRigid);

            if (index == 0 && width != 0 && height != 0)
            {
                StaticData.EngineManager.RigidsManagerEngine.AddRigidBody(
                    DefaultAdder.GetDefaultBox(positionXNA,
                                               material,
                                               halfSize,
                                               acc,
                                               initialForce,
                                               initialTorque,
                                               orientationValue,
                                               obInertia));
            }
            else
            {
                if (radius != 0 && index == 1)
                {
                    StaticData.EngineManager.RigidsManagerEngine.AddRigidBody(
                        DefaultAdder.GetDefaultSphere(positionXNA,
                                                      material,
                                                      radius,
                                                      acc,
                                                      initialForce,
                                                      initialTorque,
                                                      orientationValue,
                                                      obInertia));
                }
            }
        }
Exemplo n.º 6
0
        void bConnentToRope_Click(object sender, EventArgs e)
        {
            int ropeID = (int)UIControlsParser.GetFloat(tbRopeID);

            if (ropeID < StaticData.EngineManager.SpringsManagerEngine.ListOfServices.Count)
            {
                if (StaticData.RigidToConnectToRope != null)
                {
                    try
                    {
                        StaticData.EngineManager.SpringsManagerEngine.ListOfServices[ropeID].ApplyServiceOnRigid
                            (StaticData.RigidToConnectToRope);
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }
Exemplo n.º 7
0
        private void bHCCreateRopeOfRods_Click(object sender, EventArgs e)
        {
            Vector3 posXNA        = UIControlsParser.GetVector3(this.tbHCPosXNA);
            float   linkHeight    = UIControlsParser.GetFloat(this.tbHCLinkHeight);
            int     rigidHalfSize = (int)UIControlsParser.GetFloat(this.tbHCRigidHalfSize);
            Vector3 gravity       = UIControlsParser.GetVector3(this.tbHCGravityVec);
            //bool isExpandable = this.cbHCIsExpandable.Checked;
            float forgettingFactor = UIControlsParser.GetFloat(this.tbHCForgettingFactor);
            bool  isFixed          = this.cbHCIsFixed.Checked;
            bool  isClosed         = this.cbHCIsClosed.Checked;

            int nrOfMasses = (int)UIControlsParser.GetFloat(this.tbHCNrOfMasses);
            int spacing    = (int)UIControlsParser.GetFloat(this.tbHCSpacing);

            RopeOfRods rope = new RopeOfRods(posXNA, isFixed, isClosed, nrOfMasses, gravity, spacing, rigidHalfSize,
                                             linkHeight, forgettingFactor);

            StaticData.EngineManager.RopeOfRodsManagerEngine.ListOfRopeOfRods.Add(rope);
        }
Exemplo n.º 8
0
 void bAddCircles_Click(object sender, EventArgs e)
 {
     StaticData.CircleDefaultSize    = (int)UIControlsParser.GetFloat(tbCircleSizeDefaultCircle);
     StaticData.ManipulationGameMode = ManipulationGameMode.AddDefaultCircleMode;
 }