示例#1
0
 public Transition(List <Condition> conditions, EventNode toEventNode)
 {
     this.conditions  = conditions;
     this.toEventNode = toEventNode;
 }
        /// <summary>
        /// 編集中のパラメータをランタイム用のパラメータに設定する.
        /// </summary>
        public void SetController()
        {
            foreach (var layer in layerList)
            {
                var serializableEventNodeList = layer.serializableEventNodeList;

                //作成
                layer.eventNodeList = new List <EventNode>();

                //ノードを追加
                foreach (var serializableEventNode in serializableEventNodeList)
                {
                    var eventNode = new EventNode(serializableEventNode.eventClip)
                    {
                        name  = serializableEventNode.name,
                        entry = serializableEventNode.entry,
                        rect  = serializableEventNode.rect
                    };
                    layer.eventNodeList.Add(eventNode);


                    if (eventNode.entry)
                    {
                        layer.currentEventNode = eventNode;
                    }
                }


                //各ノードの遷移を設定する
                for (int i = 0; i < layer.eventNodeList.Count; i++)
                {
                    var eventNode             = layer.eventNodeList[i];
                    var serializableEventNode = serializableEventNodeList[i];
                    var tranditions           = new List <Transition>();
                    foreach (SerializableTransition serializableTrandition in serializableEventNode.outputTransitions)
                    {
                        var trandition = new Transition(serializableTrandition.conditions, layer.eventNodeList[serializableTrandition.indexOfToEventNode]);
                        tranditions.Add(trandition);
                    }

                    eventNode.outputTransitions = tranditions;
                }
            }


            // layerの状態設定
            foreach (var layer in layerList)
            {
                var currentEventNode = layer.currentEventNode;
                if (currentEventNode != null)
                {
                    layer.state = Layer.STATE.ON_EVENT;
                }
                else
                {
                    layer.state = Layer.STATE.NON;
                }
            }


            // parameterの設定
            parameterManager.SetMap();
        }