Finished the basics of the npc renderer. I have included the base art assets for generating a female npc and polished off all of the code. Base goal achived.

This commit is contained in:
2018-03-18 01:48:01 -07:00
parent 9162091329
commit bd6e479b4f
42 changed files with 241 additions and 12 deletions

View File

@ -36,6 +36,9 @@ namespace CustomNPCFramework
/// ///
/// Load in the assets and go go go. /// Load in the assets and go go go.
/// -Collect a bunch of assets together to test this thing. /// -Collect a bunch of assets together to test this thing.
///
/// Fix modular npc breathing.
/// Find way to make sideways shirts render correctly.
/// </summary> /// </summary>
@ -69,7 +72,7 @@ namespace CustomNPCFramework
public void initializeAssetPool() public void initializeAssetPool()
{ {
string path = Path.Combine(ModHelper.DirectoryPath, "Content", "Graphics", "NPCS", "Characters", "RainMan"); string path = Path.Combine(ModHelper.DirectoryPath, "Content", "Graphics", "NPCS");
assetPool.getAssetManager("testNPC").addPathCreateDirectory(new KeyValuePair<string, string>("characters", path)); assetPool.getAssetManager("testNPC").addPathCreateDirectory(new KeyValuePair<string, string>("characters", path));
} }
@ -117,7 +120,7 @@ namespace CustomNPCFramework
public void initializeExamples() public void initializeExamples()
{ {
return;
string dirPath = Path.Combine(ModHelper.DirectoryPath, "Content", "Templates"); string dirPath = Path.Combine(ModHelper.DirectoryPath, "Content", "Templates");
var aManager=assetPool.getAssetManager("testNPC"); var aManager=assetPool.getAssetManager("testNPC");
aManager.addPathCreateDirectory(new KeyValuePair<string, string>("templates", dirPath)); aManager.addPathCreateDirectory(new KeyValuePair<string, string>("templates", dirPath));

View File

@ -280,7 +280,7 @@ namespace CustomNPCFramework.Framework.Graphics
bodySheet = bodyList.ElementAt(bodyIndex); bodySheet = bodyList.ElementAt(bodyIndex);
eyesSheet = eyesList.ElementAt(eyesIndex); eyesSheet = eyesList.ElementAt(eyesIndex);
hairSheet = hairList.ElementAt(hairIndex); hairSheet = hairList.ElementAt(hairIndex);
shirtSheet = eyesList.ElementAt(shirtIndex); shirtSheet = shirtList.ElementAt(shirtIndex);
pantsSheet = pantsList.ElementAt(pantsIndex); pantsSheet = pantsList.ElementAt(pantsIndex);
shoesSheet = shoesList.ElementAt(shoesIndex); shoesSheet = shoesList.ElementAt(shoesIndex);

View File

@ -179,17 +179,19 @@ namespace CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases
/// <param name="layerDepth"></param> /// <param name="layerDepth"></param>
public override void draw(SpriteBatch b, ExtendedNPC npc, Vector2 position, Rectangle sourceRectangle, Color color, float alpha, Vector2 origin, float scale, SpriteEffects effects, float layerDepth) public override void draw(SpriteBatch b, ExtendedNPC npc, Vector2 position, Rectangle sourceRectangle, Color color, float alpha, Vector2 origin, float scale, SpriteEffects effects, float layerDepth)
{ {
Class1.ModMonitor.Log(sourceRectangle.ToString()); //Class1.ModMonitor.Log(sourceRectangle.ToString());
Vector2 generalOffset = new Vector2(0, 1*Game1.tileSize); Vector2 generalOffset = new Vector2(0, 1*Game1.tileSize); //Puts the sprite at the correct positioning.
this.body.draw(b, npc, position-generalOffset, sourceRectangle, color, alpha, origin, scale, effects, layerDepth); float smallOffset = 0.001f;
this.hair.draw(b, npc, position-generalOffset, sourceRectangle, color, alpha, origin, scale, effects, layerDepth); float tinyOffset = 0.0001f;
this.eyes.draw(b, npc, position-generalOffset, sourceRectangle, color, alpha, origin, scale, effects, layerDepth); this.body.draw(b, npc, position-generalOffset, sourceRectangle, color, alpha, origin, scale, effects, layerDepth + smallOffset);
this.shirt.draw(b, npc, position-generalOffset, sourceRectangle, color, alpha, origin, scale, effects, layerDepth); this.eyes.draw(b, npc, position - generalOffset, sourceRectangle, color, alpha, origin, scale, effects, layerDepth + smallOffset+(tinyOffset *1));
this.pants.draw(b, npc, position-generalOffset, sourceRectangle, color, alpha, origin, scale, effects, layerDepth); this.hair.draw(b, npc, position-generalOffset, sourceRectangle, color, alpha, origin, scale, effects, layerDepth + smallOffset+(tinyOffset *2));
this.shoes.draw(b, npc, position-generalOffset, sourceRectangle, color, alpha, origin, scale, effects, layerDepth); this.shirt.draw(b, npc, position-generalOffset, sourceRectangle, color, alpha, origin, scale, effects, layerDepth + smallOffset+(tinyOffset*3));
this.pants.draw(b, npc, position-generalOffset, sourceRectangle, color, alpha, origin, scale, effects, layerDepth + smallOffset+(tinyOffset*4));
this.shoes.draw(b, npc, position-generalOffset, sourceRectangle, color, alpha, origin, scale, effects, layerDepth + smallOffset+(tinyOffset*5));
foreach(var accessory in this.accessories) foreach(var accessory in this.accessories)
{ {
accessory.draw(b, npc, position-generalOffset, sourceRectangle, color, alpha, origin, scale, effects, layerDepth); accessory.draw(b, npc, position-generalOffset, sourceRectangle, color, alpha, origin, scale, effects, layerDepth +0.0006f);
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 569 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 520 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

View File

@ -0,0 +1,37 @@
{
"gender": 1,
"seasons": [
0,
1,
2,
3
],
"type": 0,
"assetName": "VanillaFemaleBodyBase",
"standingAssetPaths": {
"leftString": "FBodyBaseLeft",
"rightString": "FBodyBaseRight",
"upString": "FBodyBaseUp",
"downString": "FBodyBaseDown"
},
"swimmingAssetPaths": {
"leftString": "FBodyBaseLeft",
"rightString": "FBodyBaseRight",
"upString": "FBodyBaseUp",
"downString": "FBodyBaseDown"
},
"movingAssetPaths": {
"leftString": "FBodyBaseLeft",
"rightString": "FBodyBaseRight",
"upString": "FBodyBaseUp",
"downString": "FBodyBaseDown"
},
"sittingAssetPaths": {
"leftString": "FBodyBaseLeft",
"rightString": "FBodyBaseRight",
"upString": "FBodyBaseUp",
"downString": "FBodyBaseDown"
},
"assetSize": "16, 32",
"randomizeUponLoad": false
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

View File

@ -0,0 +1,37 @@
{
"gender": 1,
"seasons": [
0,
1,
2,
3
],
"type": 4,
"assetName": "VanillaGreyPants",
"standingAssetPaths": {
"leftString": "LeftFacing",
"rightString": "RightFacing",
"upString": "UpFacing",
"downString": "DownFacing"
},
"swimmingAssetPaths": {
"leftString": "LeftFacing",
"rightString": "RightFacing",
"upString": "UpFacing",
"downString": "DownFacing"
},
"movingAssetPaths": {
"leftString": "LeftFacing",
"rightString": "RightFacing",
"upString": "UpFacing",
"downString": "DownFacing"
},
"sittingAssetPaths": {
"leftString": "LeftFacing",
"rightString": "RightFacing",
"upString": "UpFacing",
"downString": "DownFacing"
},
"assetSize": "16, 32",
"randomizeUponLoad": false
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

View File

@ -0,0 +1,37 @@
{
"gender": 1,
"seasons": [
0,
1,
2,
3
],
"type": 1,
"assetName": "VanillaBrownEyes",
"standingAssetPaths": {
"leftString": "EyesLeft",
"rightString": "EyesRight",
"upString": "EyesUp",
"downString": "EyesDown"
},
"swimmingAssetPaths": {
"leftString": "EyesLeft",
"rightString": "EyesRight",
"upString": "EyesUp",
"downString": "EyesDown"
},
"movingAssetPaths": {
"leftString": "EyesLeft",
"rightString": "EyesRight",
"upString": "EyesUp",
"downString": "EyesDown"
},
"sittingAssetPaths": {
"leftString": "EyesLeft",
"rightString": "EyesRight",
"upString": "EyesUp",
"downString": "EyesDown"
},
"assetSize": "16, 32",
"randomizeUponLoad": false
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

View File

@ -0,0 +1,37 @@
{
"gender": 1,
"seasons": [
0,
1,
2,
3
],
"type": 2,
"assetName": "VanillaPigTails",
"standingAssetPaths": {
"leftString": "LeftHairStyle",
"rightString": "RightHairStyle",
"upString": "UpHairStyle",
"downString": "DownHairStyle"
},
"swimmingAssetPaths": {
"leftString": "LeftHairStyle",
"rightString": "RightHairStyle",
"upString": "UpHairStyle",
"downString": "DownHairStyle"
},
"movingAssetPaths": {
"leftString": "LeftHairStyle",
"rightString": "RightHairStyle",
"upString": "UpHairStyle",
"downString": "DownHairStyle"
},
"sittingAssetPaths": {
"leftString": "LeftHairStyle",
"rightString": "RightHairStyle",
"upString": "UpHairStyle",
"downString": "DownHairStyle"
},
"assetSize": "16, 32",
"randomizeUponLoad": false
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

View File

@ -0,0 +1,2 @@
Hairstyles seem to allow for a maximum of three pixels from the adverage top of the hairstyle to the starting of a hairstyle.
This allows for things like volume and depth of view for ponytales that rise above the typical height of a head.

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

View File

@ -0,0 +1,37 @@
{
"gender": 1,
"seasons": [
0,
1,
2,
3
],
"type": 3,
"assetName": "VanillaPinkShirt",
"standingAssetPaths": {
"leftString": "LeftFacing",
"rightString": "RightFacing",
"upString": "UpFacing",
"downString": "DownFacing"
},
"swimmingAssetPaths": {
"leftString": "LeftFacing",
"rightString": "RightFacing",
"upString": "UpFacing",
"downString": "DownFacing"
},
"movingAssetPaths": {
"leftString": "LeftFacing",
"rightString": "RightFacing",
"upString": "UpFacing",
"downString": "DownFacing"
},
"sittingAssetPaths": {
"leftString": "LeftFacing",
"rightString": "RightFacing",
"upString": "UpFacing",
"downString": "DownFacing"
},
"assetSize": "16, 32",
"randomizeUponLoad": false
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 B

View File

@ -0,0 +1,37 @@
{
"gender": 1,
"seasons": [
0,
1,
2,
3
],
"type": 5,
"assetName": "VanillaBrownShoes",
"standingAssetPaths": {
"leftString": "LeftStanding",
"rightString": "RightStanding",
"upString": "UpStanding",
"downString": "DownStanding"
},
"swimmingAssetPaths": {
"leftString": "LeftStanding",
"rightString": "RightStanding",
"upString": "UpStanding",
"downString": "DownStanding"
},
"movingAssetPaths": {
"leftString": "LeftMoving",
"rightString": "RightMoving",
"upString": "UpMoving",
"downString": "DownMoving"
},
"sittingAssetPaths": {
"leftString": "LeftStanding",
"rightString": "RightStanding",
"upString": "UpStanding",
"downString": "DownStanding"
},
"assetSize": "16, 32",
"randomizeUponLoad": false
}