示例#1
0
    void Update()
    {
        this.weight.Tick(Time.deltaTime);

        // Move the root position of each shadow to match the display model
        this.UpdateCoordinates();

        // Update the lean controller and write its shadow into the buffer
        this.lean.ControlledUpdate();
        this.lean.Encode(this.buffer1);

        // Update the anim controller and write its shadow into the buffer
        this.anim.ControlledUpdate();
        this.anim.Encode(this.buffer2, new Whitelist <string>("Spine1"));

        // Optionally, uncomment this to see the weight value
        // Debug.Log(weight);

        // Play an animation when we press T
        if (Input.GetKeyDown(KeyCode.T) == true)
        {
            this.anim.AnimPlay("dismissing_gesture");
            this.weight.ToMin();
        }

        // Fade out the animation controller if we're finished
        if (anim.IsPlaying() == false)
        {
            this.weight.ToMax();
        }

        // Blend the two controllers using the weight value
        BlendSystem.Blend(
            this.buffer1,
            new BlendPair(this.buffer1, this.weight.Value),
            new BlendPair(this.buffer2, this.weight.Inverse));

        // Write the shadow buffer to the display model, starting at the hips
        Shadow.ReadShadowData(
            this.buffer1,
            this.transform.GetChild(0),
            this);
    }
示例#2
0
 // Update is called once per frame
 void Update()
 {
     this.weight.Tick(Time.deltaTime);
     this.UpdateCoordinates();
     this.lean.ControlledUpdate();
     this.lean.Encode(this.buffer1);
     this.anim.ControlledUpdate();
     this.anim.Encode(this.buffer2, new Whitelist <string>("Spine1"));
     if (Input.GetKeyDown(KeyCode.T) == true)
     {
         this.anim.AnimPlay("dismissing_gesture");
         this.weight.ToMax();
     }
     if (anim.IsPlaying() == false)
     {
         this.weight.ToMin();
     }
     BlendSystem.Blend(this.buffer1,
                       new BlendPair(this.buffer1, this.weight.Value),
                       new BlendPair(this.buffer2, this.weight.Inverse));
     Shadow.ReadShadowData(this.buffer1, this.transform.GetChild(0), this);
 }