Esempio n. 1
0
        public int ResolveDriver(IReadOnlyReanimatorState previousState, ReanimatorState nextState, int size)
        {
            if (size == 0)
            {
                return(0);
            }
            string driverName = string.IsNullOrEmpty(name) ? guid : name;

            if (percentageBased)
            {
                float floatDriverValue = Mathf.Clamp01(previousState.GetFloat(driverName));
                if (floatDriverValue < 1)
                {
                    return(Mathf.FloorToInt(floatDriverValue * size));
                }

                return(size - 1);
            }

            int driverValue = previousState.Get(driverName) % size;

            if (autoIncrement)
            {
                nextState.Set(driverName, (driverValue + 1) % size);
            }

            return(driverValue);
        }
Esempio n. 2
0
 public virtual void ApplyToRenderer(
     ReanimatorState previousState,
     ReanimatorState nextState,
     SpriteRenderer renderer
     )
 {
     nextState.Merge(drivers);
     renderer.sprite = sprite;
     renderer.flipX  = previousState.ShouldFlip();
 }
Esempio n. 3
0
 public void ApplyToRenderer(
     ReanimatorState previousState,
     ReanimatorState nextState,
     SpriteRenderer renderer
     )
 {
     nextState.Merge(drivers);
     renderer.sprite = previousState.ShouldFlip() ? spriteLeft : sprite;
     renderer.flipX  = false;
 }
Esempio n. 4
0
 public void ApplyToRenderer(ReanimatorState previousState, ReanimatorState nextState, SpriteRenderer renderer)
 {
 }
Esempio n. 5
0
        protected void AddTrace(ReanimatorState nextState)
        {
#if UNITY_EDITOR
            nextState.AddTrace(this);
#endif
        }
Esempio n. 6
0
 public abstract TerminationNode Resolve(IReadOnlyReanimatorState previousState, ReanimatorState nextState);
Esempio n. 7
0
 public override ICel ResolveCel(IReadOnlyReanimatorState previousState, ReanimatorState nextState)
 {
     nextState.Merge(drivers);
     return(cels[controlDriver.ResolveDriver(previousState, nextState, cels.Length)]);
 }
Esempio n. 8
0
 public override TerminationNode Resolve(IReadOnlyReanimatorState previousState, ReanimatorState nextState)
 {
     AddTrace(nextState);
     nextState.Merge(drivers);
     return(this);
 }
Esempio n. 9
0
        public override TerminationNode Resolve(IReadOnlyReanimatorState previousState, ReanimatorState nextState)
        {
            AddTrace(nextState);
            var node = next.Resolve(previousState, nextState);

            if (!_map.ContainsKey(node))
            {
                return(node);
            }

            var overrideNode = _map[node];

#if UNITY_EDITOR
            nextState.AddTrace(overrideNode);
#endif
            return(overrideNode);
        }
Esempio n. 10
0
 public override TerminationNode Resolve(IReadOnlyReanimatorState previousState, ReanimatorState nextState)
 {
     AddTrace(nextState);
     nextState.Merge(drivers);
     return(nodes[controlDriver.ResolveDriver(previousState, nextState, nodes.Length)]
            .Resolve(previousState, nextState));
 }
Esempio n. 11
0
 public abstract ICel ResolveCel(IReadOnlyReanimatorState previousState, ReanimatorState nextState);