コード例 #1
0
        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));
            }
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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;
        }
コード例 #4
0
 public AgentAnimationFrame(AgentAnimator animator, AgentFrameModel mode)
 {
     this.animator = animator;
     this.model    = mode;
 }