Beispiel #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="name"></param>
 /// <param name="identification"></param>
 public CustomIdentification(string name, IDENTIFICATION identification, Type t, NODE_TYPE nodeType)
 {
     this.name           = name;
     this.identification = identification;
     this.type           = t;
     this.nodeType       = nodeType;
 }
Beispiel #2
0
        public object GetState(IDENTIFICATION identification)
        {
            object obj = null;
            CustomIdentification info = GetIdentification(identification);

            if (info.Valid())
            {
                obj = info.Create();
            }
            return(obj);
        }
Beispiel #3
0
        public CustomIdentification GetIdentification(IDENTIFICATION identification)
        {
            GetNodeList();

            for (int i = 0; i < nodeList.Count; ++i)
            {
                CustomIdentification info = nodeList[i];
                if (info.Identification == identification)
                {
                    return(info);
                }
            }

            return(new CustomIdentification());
        }
Beispiel #4
0
    private void AddNode(string nodeName, IDENTIFICATION identification, NODE_TYPE nodeType, Vector3 position, int subMachineId)
    {
        SkillHsmConfigNodeData newNodeValue = new SkillHsmConfigNodeData();

        newNodeValue.Id = GetNewstateId();

        newNodeValue.NodeName       = nodeName;
        newNodeValue.Identification = (int)identification;
        newNodeValue.NodeType       = (int)nodeType;

        Rect rect = new Rect(position.x, position.y, 150, 50);

        newNodeValue.Position = RectTExtension.RectToRectT(rect);

        if (subMachineId >= 0)
        {
            newNodeValue.ParentId = subMachineId;

            SkillHsmConfigNodeData subMachineNode = GetNode(subMachineId);
            if (subMachineNode == null || subMachineNode.NodeType != (int)NODE_TYPE.SUB_STATE_MACHINE)
            {
                Debug.LogError("Node is not SubMachine:" + subMachineId);
                return;
            }

            subMachineNode.ChildIdList.Add(newNodeValue.Id);
        }

        NodeList.Add(newNodeValue);

        if (_HSMTreeData.DefaultStateId < 0)
        {
            SetDefaultState(newNodeValue);
        }

        if (nodeType == NODE_TYPE.SUB_STATE_MACHINE)
        {
            AddNode("Entry", IDENTIFICATION.STATE_ENTRY, NODE_TYPE.ENTRY, new Vector3(900, 150, 0), newNodeValue.Id);
            AddNode("Exit", IDENTIFICATION.STATE_EXIT, NODE_TYPE.EXIT, new Vector3(900, 550, 0), newNodeValue.Id);
        }
    }