示例#1
0
        public SeriesActionsAnimationObj(StrokeCollection strokes, AnimationActionType type, Point centerOffset, Point from, List <AnimationTo> to)
            : base(strokes, type, centerOffset)
        {
            this.From = from;
            this.To   = to;

            if (this.To.Count > 0)
            {
                this.totalDuration = to.Sum(item => item.Duration);
                this.totalCount    = (int)(this.totalDuration * 1000 / AnimationEngine.Frequency);
                this.milestone     = new List <int>();

                this.milestone.Add((int)(to[0].Duration * 1000 / AnimationEngine.Frequency));
                for (int i = 1; i < to.Count; i++)
                {
                    int result = (int)(to[i].Duration * 1000 / AnimationEngine.Frequency + this.milestone[i - 1]);
                    this.milestone.Add(result);
                }

                xchange = (this.To[mileStoneIndex].To.X - this.From.X) / this.milestone[mileStoneIndex];
                ychange = (this.To[mileStoneIndex].To.Y - this.From.Y) / this.milestone[mileStoneIndex];
            }
            else
            {
                this.totalCount = 0;
            }
        }
示例#2
0
 public AnimationObj(StrokeCollection strokes, AnimationActionType type, Point centerOffset)
 {
     ID                 = Guid.NewGuid().ToString("N");
     this.Strokes       = strokes;
     this.AnimationType = type;
     this.IsPause       = true;
     this.CenterOffset  = centerOffset;
 }
示例#3
0
 public DurationActionAnimationObj(StrokeCollection strokes, AnimationActionType type, Point centerOffset, int duration, Point from, Point to)
     : base(strokes, type, centerOffset)
 {
     this.From       = from;
     this.To         = to;
     this.Duration   = duration;
     this.totalCount = this.Duration * 1000 / AnimationEngine.Frequency;
     xChange         = (To.X - From.X) / this.GetCount();
     yChange         = (To.Y - From.Y) / this.GetCount();
     posChange       = new Point(xChange, yChange);
 }
 /// <summary>
 /// Gets the duration of the specified Action. If it does not exist, returns 0.
 /// </summary>
 /// <param name="actionType">The Action to search for.</param>
 /// <returns>The duration of the specified Action.</returns>
 public float GetActionDuration(AnimationActionType actionType)
 {
     for (int i = 0; i < actions.Length; i++)
     {
         if (actions[i].actionType == actionType)
         {
             return(actions[i].duration);
         }
     }
     return(0);
 }
 /// <summary>
 /// Checks if the specified Action is included in this character's Animation Action list.
 /// </summary>
 /// <param name="actionType">The Action to search for.</param>
 /// <returns>Whether the Action is in the list.</returns>
 public bool GetAction(AnimationActionType actionType)
 {
     for (int i = 0; i < actions.Length; i++)
     {
         if (actions[i].actionType == actionType)
         {
             return(true);
         }
     }
     return(false);
 }
    static MapAnimationAction CreateAnimationAction <T>(MapAnimationFrame frame, AnimationActionType actionType) where T : MapAnimationAction
    {
        var go     = new GameObject("Action-" + actionType);
        var action = go.AddComponent <T> ();

        go.transform.SetParent(frame.transform);
        go.transform.localPosition = Vector3.zero;
        go.transform.localRotation = Quaternion.identity;
        go.transform.localScale    = Vector3.one;
        action.actionType          = actionType;
        return(action);
    }
示例#7
0
        public static AnimationObj AddDurationActionAnimation(StrokeCollection strokes, AnimationActionType type, Point centerOffset, int duration, Point from, Point to, bool isForever = false)
        {
            DurationActionAnimationObj obj = new DurationActionAnimationObj(strokes, type, centerOffset, duration, from, to);

            obj.IsForeEver = isForever;
            Cache.Add(obj);

            return(obj);
        }
示例#8
0
        public static AnimationObj AddSeriesActionsAnimation(StrokeCollection strokes, AnimationActionType type, Point centerOffset, Point from, List <AnimationTo> to, bool isForever = false)
        {
            SeriesActionsAnimationObj obj = new SeriesActionsAnimationObj(strokes, type, centerOffset, from, to);

            obj.IsForeEver = isForever;
            Cache.Add(obj);

            return(obj);
        }
 /// <summary>
 /// Creates a new AnimationAction with the specified ActionType and duration.
 /// </summary>
 /// <param name="newType">The ActionType.</param>
 /// <param name="time">The duration of this Action.</param>
 public AnimationAction(AnimationActionType newType, float time)
 {
     actionType = newType;
     duration   = time;
 }