Exemplo n.º 1
0
        public void Main(string argument, UpdateType updateSource)
        {
            if (Me.CustomData == "Walk" && st != "Walk")
            {
                if (DriveEntity.ToString() != "Program+WalkClass")
                {
                    DriveEntity = new WalkClass(buff1, buff2, Arm1, Arm2);
                    DriveEntity.LLeg.LegStatus = Utilty.PartsMoveEnum.Move_forward;
                    DriveEntity.LLeg.myMotorThigh.MyMotor.CustomData = "0," + DriveEntity.TargetListForward[0] + "," + "10";
                    DriveEntity.LLeg.myMotorKnee.MyMotor.CustomData  = "0," + DriveEntity.TargetListForward[1] + "," + "10";
                    DriveEntity.LLeg.myMotorAnkle.MyMotor.CustomData = "0," + DriveEntity.TargetListForward[2] + "," + "10";
                    DriveEntity.RLeg.LegStatus = Utilty.PartsMoveEnum.Move_Backward;
                    DriveEntity.RLeg.myMotorThigh.MyMotor.CustomData = "1," + DriveEntity.TargetListBackward[0] + "," + "10";
                    DriveEntity.RLeg.myMotorKnee.MyMotor.CustomData  = "1," + DriveEntity.TargetListBackward[1] + "," + "10";
                    DriveEntity.RLeg.myMotorAnkle.MyMotor.CustomData = "1," + DriveEntity.TargetListBackward[2] + "," + "10";
                    st = "Walk";
                }
            }
            else if (Me.CustomData == "Stational" && st != "Stational")
            {
                if (DriveEntity.ToString() != "Program+HaltClass")
                {
                    DriveEntity = new HaltClass(buff1, buff2, Arm1, Arm2);

                    DriveEntity.RLeg.myMotorThigh.MyMotor.CustomData = "1," + DriveEntity.TargetListForward[0] + "," + "10";
                    DriveEntity.RLeg.myMotorKnee.MyMotor.CustomData  = "1," + DriveEntity.TargetListForward[1] + "," + "10";
                    DriveEntity.RLeg.myMotorAnkle.MyMotor.CustomData = "1," + DriveEntity.TargetListForward[2] + "," + "10";
                    DriveEntity.LLeg.myMotorThigh.MyMotor.CustomData = "0," + DriveEntity.TargetListForward[0] + "," + "10";
                    DriveEntity.LLeg.myMotorKnee.MyMotor.CustomData  = "0," + DriveEntity.TargetListForward[1] + "," + "10";
                    DriveEntity.LLeg.myMotorAnkle.MyMotor.CustomData = "0," + DriveEntity.TargetListForward[2] + "," + "10";
                    st = "Stational";
                }
            }
            else if (Me.CustomData == "Ready" && st != "Ready")
            {
                if (DriveEntity.ToString() != "Program+ReadyClass")
                {
                    DriveEntity = new ReadyClass(buff1, buff2, Arm1, Arm2);

                    st = "Ready";
                }
            }
            else if (Me.CustomData == "ShutDown" && st != "ShutDown")
            {
                if (DriveEntity.ToString() != "Program+ShutDown")
                {
                    DriveEntity = new ShutDown(buff1, buff2, Arm1, Arm2);

                    st = "ShutDown";
                }
            }
            else if (Me.CustomData == "Run" && st != "Run")
            {
                if (DriveEntity.ToString() != "Program+RunClass")
                {
                    DriveEntity = new RunClass(buff1, buff2, Arm1, Arm2);

                    DriveEntity.LLeg.LegStatus = Utilty.PartsMoveEnum.Move_forward;
                    DriveEntity.LLeg.myMotorThigh.MyMotor.CustomData = "0," + DriveEntity.TargetListForward[0] + "," + "10";
                    DriveEntity.LLeg.myMotorKnee.MyMotor.CustomData  = "0," + DriveEntity.TargetListForward[1] + "," + "10";
                    DriveEntity.LLeg.myMotorAnkle.MyMotor.CustomData = "0," + DriveEntity.TargetListForward[2] + "," + "10";
                    DriveEntity.RLeg.LegStatus = Utilty.PartsMoveEnum.Move_Backward;
                    DriveEntity.RLeg.myMotorThigh.MyMotor.CustomData = "1," + DriveEntity.TargetListBackward[0] + "," + "10";
                    DriveEntity.RLeg.myMotorKnee.MyMotor.CustomData  = "1," + DriveEntity.TargetListBackward[1] + "," + "10";
                    DriveEntity.RLeg.myMotorAnkle.MyMotor.CustomData = "1," + DriveEntity.TargetListBackward[2] + "," + "10";
                    st = "Run";
                }
            }
            else if (Me.CustomData == "KneeFire" && st != "KneeFire")
            {
                if (DriveEntity.ToString() != "Program+HaltClass" || st != "KneeFire")
                {
                    DriveEntity = new HaltClass(buff1, buff2, Arm1, Arm2);

                    DriveEntity.LLeg.LegStatus = Utilty.PartsMoveEnum.Move_forward;
                    DriveEntity.LLeg.myMotorThigh.MyMotor.CustomData = "0,0,10";
                    DriveEntity.LLeg.myMotorKnee.MyMotor.CustomData  = "0,80,10";
                    DriveEntity.LLeg.myMotorAnkle.MyMotor.CustomData = "0,-30,10";
                    DriveEntity.RLeg.LegStatus = Utilty.PartsMoveEnum.Move_Backward;
                    DriveEntity.RLeg.myMotorThigh.MyMotor.CustomData = "0,110,10";
                    DriveEntity.RLeg.myMotorKnee.MyMotor.CustomData  = "0,80,10";
                    DriveEntity.RLeg.myMotorAnkle.MyMotor.CustomData = "0,-10,10";
                    st = "KneeFire";
                }
            }

            Vector3 move        = cockpit.MoveIndicator;
            Vector2 Rota        = cockpit.RotationIndicator;
            float   Roll        = cockpit.RollIndicator;
            var     str         = "";
            var     Orientation = cockpit.WorldMatrix.Forward;

            if (move.Z < 0)
            {
                //str = str + "Drive Forword";
                DriveEntity.ctrlStatus = Utilty.StatusEnum.Forword;
            }
            else if (move.Z > 0)
            {
                //str = str + "Drive Back";
                DriveEntity.ctrlStatus = Utilty.StatusEnum.Back;
            }
            else
            {
                //str = str + "Drive Halt";
                DriveEntity.ctrlStatus = Utilty.StatusEnum.Halt;
            }



            //str = str + "Drive Before";
            DriveEntity.Drive();
            if (Me.CustomData == "Stational")
            {
            }
            else if (Me.CustomData != "ShutDown")
            {
                // DriveEntity.armTarget(cockpit);
                // DriveEntity.AimTarget_sensor(mySensor);
            }
            //str = str + "Drive End \n";
            text.WritePublicText(str);

            Log();


            nowTime = DateTime.UtcNow;

            // GyroControl();

            befTime = nowTime;
        }