Ejemplo n.º 1
0
 public ROJOAnimation(Move move, Rotate rotate, Scale scale, AnimatedProperty property)
 {
     this.Move               = move;
     this.Rotate             = rotate;
     this.Scale              = scale;
     this.animatedProperties = property;
 }
Ejemplo n.º 2
0
 public static void ResetPropertyState(Material material, AnimatedProperty animation)
 {
     DOTween.Sequence()
     .SetId(GetTweenId(animation, animation.property.AnimationType, AnimationAction.Property))
     .SetUpdate(Settings.IgnoreUnityTimescale)
     .SetSpeedBased(Settings.SpeedBasedAnimations)
     .Append(ResetPropertyStateTween(material, animation))
     .Play();
 }
Ejemplo n.º 3
0
 private void RestoreProperty(AnimatedProperty property)
 {
     if (property.Enabled)
     {
         if (property.material != null)
         {
             ROJOAnimator.ResetPropertyState(property.material, property);
         }
     }
 }
Ejemplo n.º 4
0
 private void PlayAnimatedProperty(AnimatedProperty property)
 {
     if (property.Enabled)
     {
         if (property.material != null)
         {
             ROJOAnimator.PropertyState(property.material, property);
         }
     }
 }
Ejemplo n.º 5
0
    public static void PlayAnimation(TransformAnimationComponent target)
    {
        Move             move     = target.move;
        Scale            scale    = target.scale;
        Rotate           rotate   = target.rotate;
        AnimatedProperty property = target.animatedProperty;

        if (move.Enabled)
        {
        }
    }
Ejemplo n.º 6
0
        /************************************************************************************************************************/

        private void Awake()
        {
            _LeftFootWeight  = new AnimatedProperty(_Animancer, AnimatedProperty.Type.Float, "LeftFootIK");
            _RightFootWeight = new AnimatedProperty(_Animancer, AnimatedProperty.Type.Float, "RightFootIK");

            _Animancer.Play(_Animation);

            // Tell Unity that OnAnimatorIK needs to be called every frame.
            ApplyAnimatorIK = true;

            // Get the foot bones.
            _LeftFoot  = _Animancer.Animator.GetBoneTransform(HumanBodyBones.LeftFoot);
            _RightFoot = _Animancer.Animator.GetBoneTransform(HumanBodyBones.RightFoot);
        }
Ejemplo n.º 7
0
        private void cmdRemoveAnimation_Execute(string propertyName)
        {
            AnimatedProperty toRemove = null;

            foreach (AnimatedProperty ap in CurrentAnimatable.AnimatedProperties)
            {
                if (ap.PropertyName == propertyName)
                {
                    toRemove = ap;
                    break;
                }
            }
            if (toRemove != null)
            {
                CurrentAnimatable.AnimatedProperties.Remove(toRemove);
            }
        }
Ejemplo n.º 8
0
 public static void PropertyState(Material material, AnimatedProperty animation)
 {
     if (!animation.Enabled)
     {
         return;
     }
     if (animation.property.AnimationType != AnimationType.State)
     {
         return;
     }
     DOTween.Sequence()
     .SetId(GetTweenId(animation, animation.property.AnimationType, AnimationAction.Property))
     .SetUpdate(Settings.IgnoreUnityTimescale)
     .SetSpeedBased(Settings.SpeedBasedAnimations)
     .Append(PropertyStateTween(material, animation))
     .Play();
 }
Ejemplo n.º 9
0
    public static void PropertyPunch(Material target, AnimatedProperty animatedProperties, UnityAction onStartCallback = null, UnityAction onCompleteCallback = null)
    {
        var p = animatedProperties.property;

        if (p.propertyType == ShaderPropertyType.Color)
        {
            target.DOColor(p.colorValue, p.propertyID, p.duration / 2)
            .SetId(Utils.GetTweenId(target, AnimationType.Punch, AnimationAction.Property))
            .SetEase(p.ease)
            .OnComplete(() => target.DOColor(p.startColor, p.propertyID, p.duration / 2).SetEase(p.ease));
        }
        else
        {
            target.DOFloat(p.floatValue, p.propertyID, p.duration / 2)
            .SetId(Utils.GetTweenId(target, AnimationType.Punch, AnimationAction.Property))
            .SetEase(p.ease)
            .OnComplete(() => target.DOFloat(p.startValue, p.propertyID, p.duration / 2).SetEase(p.ease));
        }
    }
Ejemplo n.º 10
0
        public PauseMenu(GameConnectionManager connectionManager)
        {
            _connectionManager = connectionManager;

            _backgroundOpacity = new AnimatedProperty
            {
                TargetValue    = DelegateProperty.Get(() => IsVisible ? 0.75f : 0f),
                AnimationSpeed = Property.Get(8f),
            };

            var buttonLeft = new AnimatedProperty(-Button.Width - 1)
            {
                TargetValue    = DelegateProperty.Get(() => IsVisible ? 25f : -Button.Width - 1),
                AnimationSpeed = Property.Get(16 * Button.Width),
            };

            _continueButton = new Button
            {
                Text = Property.Get("Continue"),
                Left = buttonLeft,
                Top  = Property.Get(60f),
            };

            _disconnectButton = new Button
            {
                Text = Property.Get("Disconnect"),
                Left = buttonLeft,
                Top  = Property.Get(100f),
            };

            _continueButton.Click += () =>
            {
                IsVisible = false;
            };

            _disconnectButton.Click += () =>
            {
                _connectionManager.Disconnect();
            };
        }
Ejemplo n.º 11
0
        public PauseMenu(GameConnectionManager connectionManager)
        {
            _connectionManager = connectionManager;

            _backgroundOpacity = new AnimatedProperty
            {
                TargetValue = DelegateProperty.Get(() => IsVisible ? 0.75f : 0f),
                AnimationSpeed = Property.Get(8f),
            };

            var buttonLeft = new AnimatedProperty(-Button.Width - 1)
            {
                TargetValue = DelegateProperty.Get(() => IsVisible ? 25f : -Button.Width - 1),
                AnimationSpeed = Property.Get(16 * Button.Width),
            };

            _continueButton = new Button
            {
                Text = Property.Get("Continue"),
                Left = buttonLeft,
                Top = Property.Get(60f),
            };

            _disconnectButton = new Button
            {
                Text = Property.Get("Disconnect"),
                Left = buttonLeft,
                Top = Property.Get(100f),
            };

            _continueButton.Click += () =>
            {
                IsVisible = false;
            };

            _disconnectButton.Click += () =>
            {
                _connectionManager.Disconnect();
            };
        }
Ejemplo n.º 12
0
    protected void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Debug.LogErrorFormat("Duplicated {0} found in object {1}", GetType().Name, name);
            Destroy(this);
            return;
        }

        _tintAmountId = Shader.PropertyToID("_TintAmount");
        _textureId    = Shader.PropertyToID("_MainTex");
        _texture2Id   = Shader.PropertyToID("_TintTex");
        _tintColorId  = Shader.PropertyToID("_TintColor");

        tintedSkyboxMaterial = Instantiate(tintedSkyboxMaterial); // to avoid material modifications in editor
        mixedSkyboxMaterial  = Instantiate(mixedSkyboxMaterial);  // to avoid material modifications in editor

        lightRotation  = new AnimatedProperty <Quaternion>(this, lightTransform.localRotation, smoothCurve, Quaternion.Lerp, (q, p) => lightTransform.localRotation = q, (a, b) => a == b);
        lightColor     = new AnimatedProperty <Color>(this, directionalLight.color, smoothCurve, Color.Lerp, (c, p) => directionalLight.color = c, (a, b) => a == b);
        lightIntensity = new AnimatedProperty <float>(this, directionalLight.intensity, smoothCurve, Mathf.Lerp, (i, p) => directionalLight.intensity = i, (a, b) => Mathf.Abs(a - b) < Mathf.Epsilon);
        fogDensity     = new AnimatedProperty <float>(this, 0f, smoothCurve, Mathf.Lerp, (f, p) => UpdateFogAndCamera(f), (a, b) => Mathf.Abs(a - b) < Mathf.Epsilon);
        fogColor       = new AnimatedProperty <Color>(this, Color.black, smoothCurve, Color.Lerp, (c, p) => RenderSettings.fogColor = c, (a, b) => a == b);
        skybox         = new AnimatedProperty <Texture>(this, null, smoothCurve, LerpSkyboxes, UpdateSkybox,
                                                        (a, b) => a == null ? b == null : a.Equals(b));
        mainCamera = Camera.main;
        skyColor   = new AnimatedProperty <Color>(this, Color.black, smoothCurve, Color.Lerp, (c, p) => {
            mainCamera.backgroundColor = c;
            tintedSkyboxMaterial.SetColor(_tintColorId, c);
        }, (a, b) => a == b);

        _minVisibilityLog  = Mathf.Sqrt(-Mathf.Log(1f - fogIntensityOnFarPlane));
        RenderSettings.fog = false;
        _fog = false;
        RenderSettings.fogMode = FogMode.ExponentialSquared;
    }
Ejemplo n.º 13
0
    private static Tween PropertyStateTween(Material material, AnimatedProperty animation)
    {
        PropertyState state = animation.property;
        Tween         tween;

        switch (state.propertyType)
        {
        case ShaderPropertyType.Color:
            tween = material.DOColor(state.colorValue, state.propertyID, state.duration);
            break;

        default:
            tween = material.DOFloat(state.floatValue, state.propertyID, state.duration);
            break;
        }

        tween.SetDelay(animation.StartDelay)
        .SetUpdate(Settings.IgnoreUnityTimescale)
        .SetSpeedBased(Settings.SpeedBasedAnimations)
        .SetEase(animation.Ease);
        return(tween);
    }
Ejemplo n.º 14
0
 set => SetValue(AnimatedProperty, value);
Ejemplo n.º 15
0
 public static void Play(this AnimatedProperty animatedProperty)
 {
 }
Ejemplo n.º 16
0
        private void getAnimatedPropertyReference(string propertyName, IEnumerable <AnimatedProperty> animatedProperties, out AnimatedProperty ap)
        {
            if (animatedProperties == null)
            {
                ap = null;
                return;
            }

            foreach (AnimatedProperty _ap in animatedProperties)
            {
                if (_ap.PropertyName == propertyName)
                {
                    ap = _ap;
                    return;
                }
            }
            ap = null;
        }