Example #1
0
        private void drawAIScript(Graphics gr, AI_Script script)
        {
            int i;
            Pen pen = Pens.DarkSlateBlue;
            Brush brush = Brushes.DarkSlateBlue;
            Vector2 current = Vector2.Zero;
            Vector2 temp = Vector2.Zero;
            AI_ScriptNode node;

            for (i = 0; i < script.Count; i++)
            {
                if (script == SelectedAI)
                {
                    pen = new Pen(Color.GreenYellow, 2);
                    brush = Brushes.GreenYellow;
                }
                if (script.getNode(i) == SelectedAIScriptNode)
                    temp = current;
                drawScriptSegment(gr, brush, pen, ref current, script.getNode(i));
            }
            // if a node is selected and we are drawing the selected script
            if (SelectedAIScriptNode != null)
            {
                if (script == SelectedAI)
                    drawScriptSegment(gr, Brushes.Red, new Pen(Color.Red, 2), ref temp, SelectedAIScriptNode);
            }
        }
Example #2
0
 private void menuAddScript_Click(object sender, EventArgs e)
 {
     AI_Script script = new AI_Script(viewport);
     if (tvAIScripts.Nodes.Count > 0)
         script.ID = ((AI_Script)tvAIScripts.Nodes[tvAIScripts.Nodes.Count - 1].Tag).ID + 1;
     else
         script.ID = 1;
     if (menuOpener == screen)
         script.Add(new AI_StartPoint(new Vector2((float)coords.X, (float)coords.Y)));
     else
         script.Add(new AI_StartPoint(Vector2.Zero));
     script.Add(new AI_EndPoint());
     AddAIScriptToTree(script);
     tvAIScripts.SelectedNode = tvAIScripts.Nodes[tvAIScripts.Nodes.Count - 1].Nodes[0];
     modified = true;
     screen.Invalidate();
 }
Example #3
0
 private void AddAIScriptToTree(AI_Script ai)
 {
     int i;
     TreeNode subNode;
     TreeNode scriptNode = new TreeNode("Script " + ai.ID);
     scriptNode.Tag = ai;
     for (i = 0; i < ai.Count; i++)
     {
         subNode = new TreeNode(ai.getNode(i).ToString());
         subNode.Tag = ai.getNode(i);
         scriptNode.Nodes.Add(subNode);
     }
     tvAIScripts.Nodes.Add(scriptNode);
 }