示例#1
0
        // Update is called once per frame
        void Update()
        {
            _GestureManager = GestureManager.GetComponent <GestureManager>();
            _BodyManager    = BodySourceManager.GetComponent <BodySourceManager>();
            _ColorBodyView  = BodySourceManager.GetComponent <ColorBodySourceView>();

            if (_GestureManager == null || _ColorBodyView == null || _BodyManager == null)
            {
                return;
            }

            if (_MainCamera == null)
            {
                _MainCamera = GameObject.Find("ConvertCamera").GetComponent <Camera>();
            }

            if (!_IsRegMethod)
            {
                Debug.Log("REG");
                _GestureManager.GestureDetected += _GestureManager_GestureDetected;
                _IsRegMethod = true;
            }

            foreach (GameObject body in _ColorBodyView.GetBodies())
            {
                AddingTrailRendererToBody(body);
            }

            //
            EffekseerHandle eh         = EffekseerSystem.PlayEffect(_EffectNames[2], _ColorBodyView.GetBodies()[0].transform.Find(JointType.HandLeft.ToString()).transform.position);
            var             floorPlane = _BodyManager.FloorClipPlane;
            var             comp       = Quaternion.FromToRotation(new Vector3(floorPlane.X, floorPlane.Y, floorPlane.Z), Vector3.left);

            eh.SetRotation(_BodyManager.GetData()[0].JointOrientations[JointType.HandLeft].Orientation.ToQuaternion(comp));
        }
示例#2
0
    // Called each frame while the state is set to Play
    public override void PrepareFrame(Playable playable, FrameData info)
    {
        double time        = playable.GetTime();
        double elapsedTime = time - this.lastFrameTime;

        this.lastFrameTime = time;

        if (!Application.isPlaying)
        {
            if (elapsedTime < 0.0)
            {
                StopEffect();
                PlayEffect();
                elapsedTime = time;
            }
        }

        if (!effectHandle.enabled)
        {
            return;
        }

        if (emitterObject)
        {
            effectHandle.SetLocation(emitterObject.transform.position);
            effectHandle.SetRotation(emitterObject.transform.rotation);
            effectHandle.SetScale(emitterObject.transform.localScale);
        }
        if (targetObject)
        {
            effectHandle.SetTargetLocation(targetObject.transform.position);
        }

        if (!Application.isPlaying)
        {
            double frames = elapsedTime * 60.0f;
            for (int i = 0; i < frames; i++)
            {
                effectHandle.UpdateHandle(1.0f);
            }
        }
    }