コード例 #1
0
        Vector3 GetEndPosForConditional(artVisualStateNode connectedNode)
        {
            Vector3 tempVect = new Vector3();

            tempVect    = connectedNode.GetPos();
            tempVect.x += connectedNode.WinRect.width * 0.5f;
            tempVect.y += connectedNode.WinRect.height * 0.5f;

            if (this.CheckWinNodeToSeeIfItIsLinked(connectedNode))
            {
                if (connectedNode.GetPos().x < GetPos().x)
                {
                    tempVect.x -= m_ConditionOffset.x;
                }
                else
                {
                    tempVect.x += m_ConditionOffset.x;
                }

                if (connectedNode.GetPos().y < GetPos().y)
                {
                    tempVect.y -= m_ConditionOffset.y;
                }
                else
                {
                    tempVect.y += m_ConditionOffset.y;
                }
            }

            return(tempVect);
        }
コード例 #2
0
 public bool CheckWinNodeToSeeIfItIsLinked(artVisualStateNode winNode)
 {
     for (int i = 0; i < winNode.ConditionLineList.Count; i++)
     {
         if (this == winNode.ConditionLineList[i])
         {
             //Debug.Log(this.ClassName + "-> " + winNode.ClassName);
             return(true);
         }
     }
     return(false);
 }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        protected artVisualStateNode FindStateWindowsNodeByName(string name)
        {
            ArtimechEditor     theStateMachineEditor = (ArtimechEditor)GetScriptableObject;
            artVisualStateNode node = null;

            for (int i = 0; i < theStateMachineEditor.VisualStateNodes.Count; i++)
            {
                if (theStateMachineEditor.VisualStateNodes[i].ClassName == name)
                {
                    return(theStateMachineEditor.VisualStateNodes[i]);
                }
            }
            return(node);
        }
コード例 #4
0
        protected artVisualStateNode CreateVisualStateNode(string typeName)
        {
            ArtimechEditor     theStateMachineEditor = (ArtimechEditor)GetScriptableObject;
            artVisualStateNode visualNode            = new artVisualStateNode(theStateMachineEditor.VisualStateNodes.Count + 10000);

            visualNode.ClassName = typeName;

            float  posX     = 0;
            float  posY     = 0;
            float  width    = 0;
            float  height   = 0;
            string winName  = typeName;
            string strBuff  = "";
            string fileName = "";

            //fileName = utlDataAndFile.FindPathAndFileByClassName(typeName, false);
            fileName = utlDataAndFile.FindPathAndFileByClassNameByDirectoryArray(typeName, theStateMachineEditor.ConfigData.GetRefactorAndConstructionPaths());
            strBuff  = utlDataAndFile.LoadTextFromFile(fileName);

            string[] words = strBuff.Split(new char[] { '<', '>' });

            for (int i = 0; i < words.Length; i++)
            {
                if (words[i] == "alias")
                {
                    winName = words[i + 1];
                }
                if (words[i] == "posX")
                {
                    posX = Convert.ToSingle(words[i + 1]);
                }
                if (words[i] == "posY")
                {
                    posY = Convert.ToSingle(words[i + 1]);
                }
                if (words[i] == "sizeX")
                {
                    width = Convert.ToSingle(words[i + 1]);
                }
                if (words[i] == "sizeY")
                {
                    height = Convert.ToSingle(words[i + 1]);
                }
            }

            visualNode.Set(fileName, typeName, winName, posX, posY, width, height);

            return(visualNode);
        }
コード例 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fileName"></param>
        protected void CreateVisualStateNodes(string fileName)
        {
            string strBuff = utlDataAndFile.LoadTextFromFile(fileName);

            this.PopulateStateStrings(strBuff);
            ArtimechEditor theStateMachineEditor = (ArtimechEditor)GetScriptableObject;

            for (int i = 0; i < m_ListOfStateStringsInMachine.Count; i++)
            {
                artVisualStateNode node = CreateVisualStateNode(m_ListOfStateStringsInMachine[i]);
                theStateMachineEditor.VisualStateNodes.Add(node);
            }

            for (int i = 0; i < theStateMachineEditor.VisualStateNodes.Count; i++)
            {
                string stateFileName = utlDataAndFile.FindPathAndFileByClassName(theStateMachineEditor.VisualStateNodes[i].ClassName, false);
                string buffer        = utlDataAndFile.LoadTextFromFile(stateFileName);
                PopulateLinkedConditionStates(theStateMachineEditor.VisualStateNodes[i], buffer);
            }
        }
コード例 #6
0
 public conditionalSelection(artVisualStateNode node, int index)
 {
     m_VisualStateNode = node;
     m_SelectedIndex   = index;
 }
コード例 #7
0
        /// <summary>
        /// Parse the conditions from the state c sharp file.
        /// </summary>
        /// <param name="node"></param>
        /// <param name="strBuff"></param>
        protected void PopulateLinkedConditionStates(artVisualStateNode node, string strBuff)
        {
            string[] words = strBuff.Split(new char[] { ' ', '/', '\n', '\r', '_', '(' });
            bool     lookForConditionals = false;

            for (int i = 0; i < words.Length; i++)
            {
                if (words[i] == "<ArtiMechConditions>")
                {
                    lookForConditionals = true;
                }

                if (lookForConditionals && words[i] == "new")
                {
                    //check to see if stateConditionalBase
                    Type type = Type.GetType(stateEditorUtils.kArtimechNamespace + words[i + 3]);
                    if (type != null)
                    {
                        string base1Str = "";
                        string base2Str = "";
                        string base3Str = "";
                        string base4Str = "";
                        string base5Str = "";
                        string base6Str = "";
                        string base7Str = "";


                        if (type.BaseType != null)
                        {
                            base1Str = type.BaseType.Name;
                            if (type.BaseType.BaseType != null)
                            {
                                base2Str = type.BaseType.BaseType.Name;
                                if (type.BaseType.BaseType.BaseType != null)
                                {
                                    base3Str = type.BaseType.BaseType.BaseType.Name;
                                    if (type.BaseType.BaseType.BaseType.BaseType != null)
                                    {
                                        base4Str = type.BaseType.BaseType.BaseType.BaseType.Name;
                                        if (type.BaseType.BaseType.BaseType.BaseType.BaseType != null)
                                        {
                                            base5Str = type.BaseType.BaseType.BaseType.BaseType.BaseType.Name;
                                            if (type.BaseType.BaseType.BaseType.BaseType.BaseType.BaseType != null)
                                            {
                                                base6Str = type.BaseType.BaseType.BaseType.BaseType.BaseType.BaseType.Name;
                                                if (type.BaseType.BaseType.BaseType.BaseType.BaseType.BaseType.BaseType != null)
                                                {
                                                    base7Str = type.BaseType.BaseType.BaseType.BaseType.BaseType.BaseType.BaseType.Name;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }

                        //if (baseOneStr == "baseState" )//|| buffer == "stateGameBase")
                        if (base1Str == "baseState" || base2Str == "baseState" || base3Str == "baseState" || base4Str == "baseState" || base5Str == "baseState" || base6Str == "baseState" || base7Str == "baseState")
                        {
                            artVisualStateNode compNode = FindStateWindowsNodeByName(words[i + 3]);
                            if (compNode != null)
                            {
                                node.ConditionLineList.Add(compNode);
                                //Debug.Log("compNode = " + compNode.ClassName);
                            }
                        }
                    }
                }
            }
        }