Exemplo n.º 1
0
        private void TweenUpdated(ActiveTransition transition, float tween)
        {
            var target = transition.TargetVisualisation;

            // Check if the transition has gone from not started to started
            if (!transition.HasStarted && 0 < tween)
            {
                target.SetXDimension(transition.Schema.EndState.XDimension);
                target.SetYDimension(transition.Schema.EndState.YDimension);
                target.SetZDimension(transition.Schema.EndState.ZDimension);
                target.SetColour(transition.Schema.EndState.Colour);
                target.View.SetFloatProperty("_Tween", tween);
                target.SetScale(Vector3.Lerp(transition.Schema.InitialState.Scale, transition.Schema.EndState.Scale, tween));
                transition.HasStarted = true;
                return;
            }
            // Check if the transition has gone from started to not started (i.e., 0)
            else if (tween == 0 && transition.HasStarted)
            {
                target.SetXDimension(transition.Schema.InitialState.XDimension);
                target.SetYDimension(transition.Schema.InitialState.YDimension);
                target.SetZDimension(transition.Schema.InitialState.ZDimension);
                target.SetColour(transition.Schema.InitialState.Colour);
                transition.HasStarted = false;
                // Set the tween to 1 in order for there not to be a double animation
                transition.TargetVisualisation.View.SetFloatProperty("_Tween", 1);
                target.SetScale(Vector3.Lerp(transition.Schema.InitialState.Scale, transition.Schema.EndState.Scale, tween));
                return;
            }
            else
            {
                target.View.SetFloatProperty("_Tween", tween);
                target.SetScale(Vector3.Lerp(transition.Schema.InitialState.Scale, transition.Schema.EndState.Scale, tween));
            }
        }
Exemplo n.º 2
0
 private void AbstractVisualisationUpdated(AbstractVisualisation aVis, IATKProperty property)
 {
     // When any visualisation is updated, check to see which schema it might be corresponding to
     foreach (var schema in Schemas)
     {
         if (schema.InitialState.XDimension.Name == aVis.XDimension.Name &&
             schema.InitialState.YDimension.Name == aVis.YDimension.Name &&
             schema.InitialState.ZDimension.Name == aVis.ZDimension.Name
             )
         {
             if (!Transitions.Select(x => x.TargetVisualisation).Contains(aVis))
             {
                 ActiveTransition transition = new ActiveTransition(schema, aVis);
                 transition.TweenUpdated.AddListener(TweenUpdated);
                 Transitions.Add(transition);
             }
         }
     }
 }