Пример #1
0
    //コピーしたステートのペースト
    private void OnClickPasteNode(Vector2 mousePosition)
    {
        if (copyNode == null)
        {
            return;
        }
        NomalState statePlus = new NomalState();

        statePlus.execDelegate   = new List <StateBase.ActionDelegate>(copyNode.myState.execDelegate);
        statePlus.stateName      = copyNode.myState.stateName + "(Clone)";
        statePlus.nextStateJudge = new List <NextStateJudge>(copyNode.myState.nextStateJudge);
        for (int i = 0; i < statePlus.nextStateJudge.Count; i++)
        {
            statePlus.nextStateJudge[i].nextID        = null;
            statePlus.nextStateJudge[i].nextState     = null;
            statePlus.nextStateJudge[i].nextStateName = null;
        }
        statePlus.playUpdateDelegate = new List <StateBase.ActionDelegate>(copyNode.myState.playUpdateDelegate);
        states.Add(statePlus);
        if (nodes == null)
        {
            nodes = new List <Node>();
        }
        //マウスの場所に追加
        nodes.Add(new Node(new Rect(mousePosition.x, mousePosition.y, 200, 50), inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, " ", nowId, statePlus, gameObject, stateMonobehaviors[nowStateMonoNuber]));
        nowId++;
        initFlag = true;
    }
Пример #2
0
    //ノードの追加
    private void OnClickAddNode(Vector2 mousePosition)
    {
        //ノード、ステート追加
        NomalState statePlus = new NomalState();

        states.Add(statePlus);

        if (nodes == null)
        {
            nodes = new List <Node>();
        }
        //マウスの場所に追加
        nodes.Add(new Node(new Rect(mousePosition.x, mousePosition.y, 200, 50), inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, " ", nowId, statePlus, gameObject, stateMonobehaviors[nowStateMonoNuber]));
        nowId++;
    }
Пример #3
0
 /// <summary>
 /// 初期化
 /// </summary>
 public Node(
     Rect recPos,
     GUIStyle inPointStyle,
     GUIStyle outPointStyle,
     Action <NodeConnectionPoint> OnClickInPoint,
     Action <NodeConnectionPoint> OnClickOutPoint,
     Action <Node> OnClickRemoveNode,
     string title,
     int id,
     NomalState nomalS,
     GameObject game,
     StateMonobehavior monobehavior
     )
 {
     rect              = recPos;                                                                              //ウィンドウの大きさ設定
     inPoint           = new NodeConnectionPoint(this, ConnectionPointType.In, inPointStyle, OnClickInPoint); //入力ポイント
     OnRemoveNode      = OnClickRemoveNode;
     this.title        = title;
     ID                = id;
     myState           = nomalS;
     gameObject        = game;
     stateMonobehavior = monobehavior;
     //出力ポイント
     for (int i = 0; i < myState.nextStateJudge.Count; i++)
     {
         StateOutPoint rectOut = new StateOutPoint();
         rectOut.stateJudge = myState.nextStateJudge[i];
         rectOut.outPoint   = new NodeConnectionPoint(this, ConnectionPointType.Out, outPointStyle, OnClickOutPoint, myState.nextStateJudge[i]);
         outPoints.Add(rectOut);
     }
     //アップデート中の処理
     for (int i = 0; i < myState.playUpdateDelegate.Count; i++)
     {
         FuncList list = new FuncList();
         list.actionDelegate = myState.playUpdateDelegate[i];
         updateFuncs.Add(list);
     }
     //ステートになった時の処理
     for (int i = 0; i < myState.execDelegate.Count; i++)
     {
         FuncList list = new FuncList();
         list.actionDelegate = myState.execDelegate[i];
         startFuncs.Add(list);
     }
 }