Exemplo n.º 1
0
    protected override void OnReceive(MultiValue values)
    {
        if (isPositionSync) {
            syncStartPos_ = transform.position;
            syncEndPos_   = values.Pop().value.AsVector3();
            if (isFirst_) transform.position = syncEndPos_;
        }

        if (isRotationSync) {
            syncStartRot_ = transform.rotation;
            syncEndRot_   = values.Pop().value.AsQuaternion();
            if (isFirst_) transform.rotation = syncEndRot_;
        }

        if (isScaleSync) {
            syncStartScale_ = transform.localScale;
            syncEndScale_   = values.Pop().value.AsVector3();
            if (isFirst_) transform.localScale = syncEndScale_;
        }

        syncStartTime_ = Time.time;
        syncEndTime_   = syncStartTime_ + sendCycle;

        if (isFirst_) isFirst_ = false;
    }
Exemplo n.º 2
0
 protected override void OnReceive(MultiValue data)
 {
     while (data.values.Count > 0) {
         var name  = data.Pop().value;
         var param = data.Pop();
         switch (param.type) {
             case "bool":
                 animator.SetBool(name, param.value.AsBool());
                 break;
             case "int":
                 animator.SetInteger(name, param.value.AsInt());
                 break;
             case "float":
                 animator.SetFloat(name, param.value.AsFloat());
                 break;
         }
     }
 }