コード例 #1
0
    void FixedUpdate()
    {
        currFrameVel = float.Parse(table.Read((int)currentFrame, 2));

        if (!playingAnim)
        {
            currentFrame = GetBestFrame();                               // Here the best possible frame is picked and it's ready to be played
            animator.Play(animationName, 0, currentFrame / totalFrames); // The selected frame is played
            animator.Play("walking1", 0, currentFrame / totalFrames);
            animator.SetBool("Go", true);
            //animator.SetBool("Go", false);
            playingAnim = true; // Sets up the flag for indicating that some frames need to be played before choosing again
        }

        else
        {
            currentFrame = (currentFrame + 1) % totalFrames; // The next frame is selected to be played
            if (currentFrame == 0)
            {
                currentFrame = 2;
            }                                                            // Avoid T-Pose

            animator.Play(animationName, 0, currentFrame / totalFrames); // Frame is played
            animator.Play("walking1", 0, currentFrame / totalFrames);


            frameCount++;        // Increment count to know when to stop playing frames

            if (frameCount >= 5) // When 10 frames are played, it's time to choose a frame again
            {
                playingAnim = false;
                frameCount  = 0;
            }
        }
    }
コード例 #2
0
        /// <summary>
        /// 获取类文本
        /// </summary>
        /// <param name="table"></param>
        /// <returns></returns>
        string GetClassStr(CsvTable table, string csvName)
        {
            var classText = new ClassText(m_Config.namespaceStr, csvName, m_Config.isClass);
            var len       = table.RawDataList[0].Count;

            for (var i = 0; i < len; i++)
            {
                var fieldName = table.Read(0, i);
                var fieldType = table.Read(1, i);
                var fieldNode = new FieldNode(fieldName, fieldType);
                classText.Add(fieldNode);
            }

            return(classText.GetClassText());
        }
コード例 #3
0
 public List <SortedCommandPair> GetCommandMappings()
 {
     return
         (CsvTable.Read(Resources.CommandMappingsStatistic)
          .Rows.Select(row => SortedCommandPair.NewSortedPair(row["FirstCommand"], row["SecondCommand"]))
          .ToList());
 }
コード例 #4
0
        public void UsesSpecifiedFieldDelimiter()
        {
            var actual = CsvTable.Read(new[] { "A;B", "1;2" }.ToCsv(), ';');

            Assert.AreEqual("1", actual.Rows[0]["A"]);
            Assert.AreEqual("2", actual.Rows[0]["B"]);
        }
コード例 #5
0
        public void UsesFieldNames()
        {
            var actual = CsvTable.Read(new[] { "A,B", "1,2" }.ToCsv());

            Assert.AreEqual("1", actual.Rows[0]["A"]);
            Assert.AreEqual("2", actual.Rows[0]["B"]);
        }
コード例 #6
0
        public CommandEventToActivityMapper()
        {
            // TODO @Sven make constructor paramters for mapper possible and move this to outside of here
            var mappingCsv             = Resources.CommandIdToActivityMapping;
            var commandIdToActivityMap = CsvTable.Read(mappingCsv);

            foreach (var csvRow in commandIdToActivityMap.Rows)
            {
                _commandIdToActivityMapping[csvRow["Command ID"]] = ToActivity(csvRow["Mapping"]);
            }


            RegisterFor <CommandEvent>(ProcessCommandEvent);
        }
コード例 #7
0
ファイル: CsvTest.cs プロジェクト: Jacudibu/GameMixer2021
        private void OnGUI()
        {
            GUILayout.Space(30);

            //Display csv table
            foreach (var row in table.RawDataList)
            {
                using (new GUILayout.HorizontalScope())
                {
                    foreach (var value in row)
                    {
                        GUILayout.Label(value, GUILayout.Width(150));
                    }
                }
            }

            GUILayout.Space(100);

            //Modify UI
            using (new GUILayout.HorizontalScope())
            {
                GUILayout.Label("Row:", GUILayout.Width(buttonWidth));
                rowStr = GUILayout.TextField(rowStr);
                int.TryParse(rowStr, out row);
                rowStr = row.ToString();

                GUILayout.Space(20);

                GUILayout.Label("Column:", GUILayout.Width(buttonWidth));
                columnStr = GUILayout.TextField(columnStr);
                int.TryParse(columnStr, out column);
                columnStr = column.ToString();
            }
            using (new GUILayout.HorizontalScope())
            {
                if (GUILayout.Button("Read", GUILayout.Width(buttonWidth)))
                {
                    readValue = table.Read(row, column);
                }
                GUILayout.TextArea(readValue);
            }
            using (new GUILayout.HorizontalScope())
            {
                if (GUILayout.Button("Write", GUILayout.Width(buttonWidth)))
                {
                    table.Write(row, column, writeValue);
                }
                writeValue = GUILayout.TextArea(writeValue);
            }
            using (new GUILayout.HorizontalScope())
            {
                using (new GUILayout.VerticalScope(GUILayout.Width(buttonWidth)))
                {
                    if (GUILayout.Button("PaddingData"))
                    {
                        var testRowData = CsvHelper.PaddingData <TestRowData>(text.name, rowID);
                        rowDataStr = testRowData.ToString();
                    }
                    rowID = GUILayout.TextField(rowID);
                }
                GUILayout.TextArea(rowDataStr);
            }
        }
コード例 #8
0
ファイル: CsvTest.cs プロジェクト: heyadong-cn/MotionMatching
 private void Start()
 {
     CsvHelper.Init();
     table = CsvHelper.Create(text.name, text.text);
     Debug.Log("Test: " + table.Read(2000, 5));
 }
コード例 #9
0
 public String getMessage(int column)
 {
     return(table.Read((int)UnityEngine.Random.Range(2, numberOfMessages), column));
 }
コード例 #10
0
        public void ReadsRows()
        {
            var actual = CsvTable.Read(new[] { "A,B", "1,2", "3,4" }.ToCsv());

            Assert.AreEqual(2, actual.Rows.Count);
        }