示例#1
0
        private void AddComponents()
        {
            SpriterReader   reader   = new SpriterReader();
            SpriterImporter importer = new SpriterImporter();
            var             model    = reader.Read(importer.Import(Path.Combine("Content\\Spriter", "player.scml")), null, game.Content,
                                                   game.GraphicsDevice);

            Animator = new FarmPlayerAnimator(this, model, "player");
            //Animator.AnimationEnded += Animator_AnimationEnded;
            Animator.Scale     = 1.0f;
            animationComponent = new AnimationComponent(this, Animator, "idle_down");

            Components.AddComponent(animationComponent);
            Components.AddComponent(new ExclamationMarkDrawer(game, this));
            Components.AddComponent(new MessageBoxComponent(game, this));
            Components.AddComponent(Inventory     = new PlayerInventory(this));
            Components.AddComponent(viewComponent = new ViewComponent(new Vector2(0, 1)));
            CreateTools();

            WidgetManager widgets = new WidgetManager(game, this);

            widgets.AddWidget(new ItemWidget(game, this, widgets, "Tool widget"));
            widgets.AddWidget(new TimeWidget(game, this, widgets, "Time and date widget"));
            Components.AddComponent(widgets);
        }
示例#2
0
 static SpriterTypeReader()
 {
     Reader = SpriterReader.Default;
 }