public AgentAnimation(AgentAnimator animator, string name, AgentAnimationModel model) { this.model = model; Name = name; Frames = new List <AgentAnimationFrame>(); foreach (var frame in model.Frames) { Frames.Add(new AgentAnimationFrame(animator, frame)); } }
public bool Animate() { if (Hidden) { return(false); } var animations = Animator.Animations.Where(s => !s.IsIdle()) .ToList(); var animation = AgentAnimator.GetRandomAnimation(animations); return(Play(animation.Name)); }
public Agent(string agent) { //we initialize context queue = new QueueProcessor(); var agentJson = AssemblyHelper.ReadResourceString(agent, "agent.json"); Model = JsonConvert.DeserializeObject <AgentModel>(agentJson); ImageSize = new Size(Model.FrameSize[0], Model.FrameSize[1]); Animator = new AgentAnimator(agent, this); Animator.NeedsRefresh += Animator_NeedsRefresh; }
public AgentAnimationFrame(AgentAnimator animator, AgentFrameModel mode) { this.animator = animator; this.model = mode; }