Пример #1
0
        private void setNewWorldMX_Click(object sender, EventArgs e)
        {
            BVHAction bvh = (BVHAction)actions.SelectedItem;

            bvh.WorldMX = Matrix.CreateRotationY(-S.camera.AngleA);
            update_label_text();
        }
Пример #2
0
        private void setStartFrame_Click(object sender, EventArgs e)
        {
            BVHAction bvh = (BVHAction)actions.SelectedItem;

            bvh.StartFrame = S.player.Frame;
            update_label_text();
            update_trackbar_rects();
        }
Пример #3
0
 void player_OnActionComplete(BVHAction previous, BVHAction current)
 {
     if (previous.Name == "leap")
     {
         velocity.Y           = 10;
         Player.CurrentAction = Actions["jump"];
     }
 }
Пример #4
0
        public BVHActionPlayer(BVHAction defaultAction, Color color)
        {
            this.CurrentAction     =
                this.DefaultAction = defaultAction;

            cylinder = new NCylinder(0.21f, 0.08f, 1, 6, color);
            bvh      = S.bvhDic[CurrentAction.Bvhfile];
            change_bvh(bvh, true);
        }
Пример #5
0
        private void setAttackDir_Click(object sender, EventArgs e)
        {
            BVHAction action =
                (BVHAction)actions.SelectedItem;

            if (S.player.Frame >= action.StartFrame &&
                S.player.Frame <= action.EndFrame)
            {
                Vector3 dir =
                    S.camera.usedCamPos -
                    S.camera.focus.Position;
                dir.Normalize();

                BVHAttackAction attackAction;

                if (action is BVHAttackAction)
                {
                    attackAction = (BVHAttackAction)action;
                }
                else
                {
                    attackAction = new BVHAttackAction(action);
                }

                if (attackAction.attackDrcs.ContainsKey(
                        S.player.Frame))
                {
                    attackAction.attackDrcs.Remove(S.player.Frame);

                    S.attackDirMatrix = Matrix.CreateTranslation(Vector3.One * float.PositiveInfinity);
                }
                else
                {
                    attackAction.attackDrcs.Add(
                        S.player.Frame, dir);

                    S.attackDirMatrix = S.point_to_axis_angle(
                        attackAction.attackDrcs[S.player.Frame]);
                }
                if (!(action is BVHAttackAction))
                {
                    actions.Items.Remove(action);
                    actions.Items.Add(attackAction);
                }

                update_label_text(attackAction.ToXml());
            }
            else
            {
                MessageBox.Show("You are not in range of action.");
            }

            update_trackbar_rects();
        }
Пример #6
0
        private void splitBVHByActionsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < actions.Items.Count; i++)
            {
                BVHAction act  = (BVHAction)(actions.Items[i]);
                string    file = S.player.Bvh.split_bvh(
                    act.StartFrame,
                    act.EndFrame);

                File.WriteAllText("C:/" + i.ToString() + ".txt",
                                  file);
            }
            Process.Start("C:/");
        }
Пример #7
0
        private string get_xml()
        {
            string str = string.Empty;

            BVHAction[] all = new BVHAction[actions.Items.Count];
            actions.Items.CopyTo(all, 0);
            BVHAction[] other   = get_actions_by_type("other", all);
            BVHAction[] defense = get_actions_by_type("defense", all);
            BVHAction[] damaged = get_actions_by_type("damaged", all);
            BVHAction[] attack  = get_actions_by_type("attack", all);

            str += "<?xml version=\"1.0\" encoding=\"utf-8\" ?>";
            str += "<XnaContent>";
            str += "<Asset Type=\"XmlLib.ActionCollection\">";
            str += "<rootMovements>";
            foreach (RootMovement rm in saveRootMovement)
            {
                str += "<Item>" + rm.ToString() + "</Item>";
            }
            str += "</rootMovements>";
            str += "<other>";
            for (int i = 0; i < other.Length; i++)
            {
                str += other[i].ToXml() + "\n";
            }
            str += "</other>";
            str += "<defense>";
            for (int i = 0; i < defense.Length; i++)
            {
                str += defense[i].ToXml() + "\n";
            }
            str += "</defense>";
            str += "<damaged>";
            for (int i = 0; i < damaged.Length; i++)
            {
                str += damaged[i].ToXml() + "\n";
            }
            str += "</damaged>";
            str += "<attack>";
            for (int i = 0; i < attack.Length; i++)
            {
                str += attack[i].ToXml() + "\n";
            }
            str += "</attack>";

            str += "</Asset></XnaContent>";

            return(str);
        }
Пример #8
0
        private void fplTxt_TextChanged(object sender, EventArgs e)
        {
            if (actions.SelectedIndex != -1)
            {
                BVHAction action = (BVHAction)actions.SelectedItem;

                float fpl;
                if (float.TryParse(fplTxt.Text, out fpl))
                {
                    action.FramesPerLoop = fpl;
                }
                else
                {
                    fplTxt.Text = fpl.ToString();
                }
            }
        }
Пример #9
0
        private void add_Click(object sender, EventArgs e)
        {
            #region add new bvhaction
            string name = Microsoft.VisualBasic.
                          Interaction.InputBox("Title", "Prompt", "Default", 0, 0);
            if (name != string.Empty)
            {
                string fln = Game1.filename;
                fln = Game1.filename.Substring(fln.LastIndexOf('\\') + 1);
                fln = fln.Substring(0, fln.IndexOf('.'));
                BVHAction act = new BVHAction(fln, (string)type.SelectedItem, Matrix.Identity,
                                              name, S.player.Frame, S.player.Frame + 100, cyclicCb.Checked, 1);
                if (act.EndFrame >= S.player.Bvh.MXI.FrameCount)
                {
                    act.EndFrame =
                        S.player.Bvh.MXI.FrameCount - 1;
                }
                actions.Items.Add(act);
                actions.SetSelected(actions.Items.Count - 1, true);
            }
            #endregion

            update_trackbar_rects();
        }
Пример #10
0
        private void actions_SelectedIndexChanged(object sender, EventArgs e)
        {
            S.action = (BVHAction)actions.SelectedItem;
            update_label_text();

            Game1.chosenBones = new List <int>();

            targetGb.Enabled = false;

            fplTxt.Enabled                                                =
                skillsGb.Enabled                                          =
                    tabPage4.Enabled                                      =
                        setAttackBtn.Enabled                              =
                            setAttackDir.Enabled                          =
                                markingBones.Enabled                      =
                                    remove.Enabled                        =
                                        playAction.Enabled                =
                                            setEndFrame.Enabled           =
                                                setStartFrame.Enabled     =
                                                    setNewWorldMX.Enabled = actions.SelectedIndex != -1;

            skillsList.SelectedIndex = -1;


            if (actions.SelectedIndex != -1)
            {
                BVHAction action
                    = (actions.SelectedItem as BVHAction);

                fplTxt.Text = action.FramesPerLoop.ToString();

                cyclicCb.Checked = action.IsCyclic;
                type.Text        = action.Type;

                if (actions.SelectedItem is BVHAttackAction)
                {
                    setAttackBtn.Enabled = false;
                    Game1.chosenBones    = (actions.SelectedItem
                                            as BVHAttackAction).collisionBones;
                }
                else
                {
                    if (action.Type.ToLower() == "attack")
                    {
                        setAttackBtn.Enabled     = true;
                        setAttackDir.Enabled     =
                            markingBones.Enabled = false;
                    }
                    else
                    {
                        setAttackBtn.Enabled         =
                            setAttackDir.Enabled     =
                                markingBones.Enabled = false;
                    }
                }

                skillsList.Items.Clear();

                foreach (Skill skill in ((BVHAction)actions.SelectedItem).Skills)
                {
                    skillsList.Items.Add(skill);
                }

                skillTargets.Items.Clear();
            }

            if (actions.SelectedItem is BVHAttackAction)
            {
                BVHAttackAction action =
                    ((BVHAttackAction)actions.
                     SelectedItem);

                if (action != null &&
                    action.attackDrcs.ContainsKey(S.player.Frame))
                {
                    S.attackDirMatrix = S.point_to_axis_angle(
                        action.attackDrcs[S.player.Frame]);
                }
            }
        }