public ExtendedNPC(Sprite sprite, BasicRenderer renderer, Portrait portrait, Vector2 position, int facingDirection, string name) : base(sprite.sprite, position, facingDirection, name, null)
 {
     this.characterRenderer   = renderer;
     this.portraitInformation = portrait;
     this.portraitInformation.setCharacterPortraitFromThis(this);
     this.spriteInformation = sprite;
     this.spriteInformation.setCharacterSpriteFromThis(this);
     this.swimming = false;
 }
Exemple #2
0
 /// <summary>Construct an instance.</summary>
 /// <param name="sprite">The sprite for the character to use incase the renderer is null.</param>
 /// <param name="renderer">The custom npc render. Used to draw the npcfrom a collection of assets.</param>
 /// <param name="position">The position of the npc on the map.</param>
 /// <param name="facingDirection">The direction of the npc</param>
 /// <param name="name">The name of the npc.</param>
 public ExtendedNpc(Sprite sprite, BasicRenderer renderer, Vector2 position, int facingDirection, string name)
     : base(sprite.sprite, position, facingDirection, name)
 {
     this.characterRenderer   = renderer;
     this.Portrait            = null;
     this.portraitInformation = null;
     this.spriteInformation   = sprite;
     this.spriteInformation?.setCharacterSpriteFromThis(this);
     this.swimming.Value = false;
 }
Exemple #3
0
 /// <summary>
 /// Non modular npc Constructor.
 /// </summary>
 /// <param name="sprite">The sprite for the character.</param>
 /// <param name="position">The position of the npc on the map.</param>
 /// <param name="facingDirection">The direction of the npc</param>
 /// <param name="name">The name of the npc.</param>
 public ExtendedNPC(Sprite sprite, Vector2 position, int facingDirection, string name) : base(sprite.sprite, position, facingDirection, name, null)
 {
     this.characterRenderer   = null;
     this.Portrait            = (Texture2D)null;
     this.portraitInformation = null;
     this.spriteInformation   = sprite;
     if (this.spriteInformation != null)
     {
         this.spriteInformation.setCharacterSpriteFromThis(this);
     }
     this.swimming.Value = false;
 }
Exemple #4
0
        /// <summary>
        /// Creates a character renderer (a collection of textures) from a bunch of different asset sheets.
        /// </summary>
        /// <param name="bodySheet">The textures for the npc's body.</param>
        /// <param name="eyesSheet">The textures for the npc's eyes.</param>
        /// <param name="hairSheet">The textures for the npc's hair.</param>
        /// <param name="shirtSheet">The textures for the npc's shirt.</param>
        /// <param name="pantsSheet">The textures for the npc's pants.</param>
        /// <param name="shoesSheet">The textures for the npc's shoes.</param>
        /// <param name="accessorySheet">The textures for the npc's accessories.</param>
        /// <param name="DrawColors">The colors for the npc's different assets.</param>
        /// <returns></returns>
        public virtual BasicRenderer generateBasicRenderer(AssetSheet bodySheet, AssetSheet eyesSheet, AssetSheet hairSheet, AssetSheet shirtSheet, AssetSheet pantsSheet, AssetSheet shoesSheet, List <AssetSheet> accessorySheet, StandardColorCollection DrawColors = null)
        {
            if (DrawColors == null)
            {
                DrawColors = new StandardColorCollection();
            }
            //Get all of the appropriate animations.
            AnimationType type = AnimationType.standing;
            var           standingAnimation = generateCharacterAnimation(bodySheet, eyesSheet, hairSheet, shirtSheet, pantsSheet, shoesSheet, accessorySheet, type, DrawColors);

            type = AnimationType.walking;
            var movingAnimation = generateCharacterAnimation(bodySheet, eyesSheet, hairSheet, shirtSheet, pantsSheet, shoesSheet, accessorySheet, type, DrawColors);

            type = AnimationType.swimming;
            var swimmingAnimation = generateCharacterAnimation(bodySheet, eyesSheet, hairSheet, shirtSheet, pantsSheet, shoesSheet, accessorySheet, type, DrawColors);

            BasicRenderer render = new BasicRenderer(standingAnimation, movingAnimation, swimmingAnimation);

            return(render);
        }
Exemple #5
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            _graphicSettings.Initialize();

            CustomContentLoader loader   = new CustomContentLoader(this.Content);
            CustomWorld         world    = new CustomWorld(new CustomPhysicGenerator(loader));
            Tracker             tracker  = new Tracker(world.Player, 15f);
            Renderer            renderer = new BasicRenderer(_graphicSettings, Content, 45f, tracker);

            _logic   = new LogicManager(world);
            _graphic = new GraphicManager(_logic, tracker, renderer, new CustomGraphicGenerator(loader));

            CustomActionList actionList = new CustomActionList(this, _graphicSettings, world, tracker);
            KeyboardHandler  kh         = new KeyboardHandler(new CustomKeyboardBindingMap(actionList));
            MouseHandler     mh         = new MouseHandler(new CustomMouseBindingMap(actionList), true);

            _input = new InputManager(kh, mh);

            _logic.Start();

            base.Initialize();
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="Stock">The list of items this npc will sell.</param>
 /// <param name="sprite">The sprite for the npc to use.</param>
 /// <param name="renderer">The renderer for the npc to use.</param>
 /// <param name="position">The position for the npc to use.</param>
 /// <param name="facingDirection">The facing direction for the player to face.</param>
 /// <param name="name">The name for the npc.</param>
 public MerchantNPC(List <Item> Stock, Sprite sprite, BasicRenderer renderer, Vector2 position, int facingDirection, string name) : base(sprite, renderer, position, facingDirection, name)
 {
     this.stock = Stock;
 }
Exemple #7
0
 protected Screen(string name)
 {
     Renderer = new BasicRenderer(this);
     Name     = name;
 }