コード例 #1
0
        public void OnHandleSizeIntent(WitResponseNode node)
        {
            var intent = node.GetFirstIntentData();

            var size  = node.GetFirstWitIntValue("wit:number", 1);
            var shape = node.GetFirstWitEntity("shape:shape");

            if (shape.confidence > .5)
            {
                var shapeTransform = transform.Find(shape);
                if (shapeTransform)
                {
                    shapeTransform.localScale = Vector3.one * 10 / ((float)size);
                }
            }
        }
コード例 #2
0
        public void OnHandleColorIntent(WitResponseNode node)
        {
            var intent = node.GetFirstIntentData();

            var color = node.GetFirstWitEntity("color:color");

            if (color == null)
            {
                return;
            }

            if (color == "red")
            {
                Debug.Log("The cube is red!");
            }

            Debug.Log("OnHandleColorIntent was triggered with color " +
                      color);
        }