//Function called from OnGUI to assign cloak sprites private void AssignCloakSprites(string spritePrefix_) { //If we don't have a cloak armor item, nothing happens if (this.cloak == null || this.cloak.slot != Armor.ArmorSlot.Cloak) { return; } //Creating a new list of all of the sprite views this.cloak.armorSpriteViews = new List <SpriteViews>(); //Assigning the cloak sprites SpriteViews cloak0 = this.GetAllSpriteViews(spritePrefix_, 86, 130, 108, BodyTypes.IgnoreBodyType); this.cloak.armorSpriteViews.Add(cloak0); //Setting this cloak object to dirty so that it saves the changes Undo.RecordObject(this.cloak, "Set Cloak Sprites"); EditorUtility.SetDirty(this.cloak); }
//Function called from OnGUI to assign glove sprites private void AssignGloveSprites(string spritePrefix_) { //If we don't have a glove armor item, nothing happens if (this.gloves == null || this.gloves.slot != Armor.ArmorSlot.Hands) { return; } //Creating a new list of all of the sprite views this.gloves.armorSpriteViews = new List <SpriteViews>(); //Assigning the glove sprites SpriteViews glove0 = this.GetAllSpriteViews(spritePrefix_, 43, 21, 43, BodyTypes.IgnoreBodyType); this.gloves.armorSpriteViews.Add(glove0); //Setting this glove object to dirty so that it saves the changes Undo.RecordObject(this.gloves, "Set Glove Sprites"); EditorUtility.SetDirty(this.gloves); }
//Function called from OnGUI to assign helm sprites private void AssignHelmSprites(string spritePrefix_) { //If we don't have a helm armor item, nothing happens if (helm == null || helm.slot != Armor.ArmorSlot.Head) { return; } //Creating a new list of all of the sprite views this.helm.armorSpriteViews = new List <SpriteViews>(); //Assigning the helm sprites SpriteViews helm0 = this.GetAllSpriteViews(spritePrefix_, 109, 65, 87, BodyTypes.IgnoreBodyType); this.helm.armorSpriteViews.Add(helm0); //Setting this helm object to dirty so that it saves the changes Undo.RecordObject(this.helm, "Set Helm Sprites"); EditorUtility.SetDirty(this.helm); }
//Function called from all of the Assign Sprites functions. Returns a SpriteView class with all of the designated sprites private SpriteViews GetAllSpriteViews(string prefix_, int frontViewIndex_, int sideViewIndex_, int backViewIndex_, BodyTypes bodyType_) { //Getting the asset path string to the sprite for the front view string[] frontViewSpriteGUID = AssetDatabase.FindAssets(prefix_ + "" + frontViewIndex_); string spritePath = AssetDatabase.GUIDToAssetPath(frontViewSpriteGUID[0]); //Getting the array of all sprites in the base sprite's multi-sprite sheet Sprite[] allMultiSprites = AssetDatabase.LoadAllAssetsAtPath(spritePath).OfType <Sprite>().ToArray(); //Loading the sprites using their paths Sprite frontView = allMultiSprites[frontViewIndex_]; Sprite sideView = allMultiSprites[sideViewIndex_]; Sprite backView = allMultiSprites[backViewIndex_]; //Creating the sprite view class to hold our sprites SpriteViews newSV = new SpriteViews(); newSV.front = frontView; newSV.side = sideView; newSV.back = backView; newSV.bodyType = bodyType_; return(newSV); }
//Function called externally to set all of the sprite images for a character public void SetSpriteImages(CharSpritePackage cSprites_, Inventory characterInventory_) { //Setting the forward sprites this.forwardHair.sprite = cSprites_.hairSprites.front; this.forwardFacialHair.sprite = cSprites_.facialHairSprites.front; this.forwardHead.sprite = cSprites_.headSprites.front; this.forwardLeftEye.sprite = cSprites_.eyeSprite; this.forwardRightEye.sprite = cSprites_.eyeSprite; this.forwardBody.sprite = cSprites_.bodySprites.front; this.forwardRightArm.sprite = cSprites_.rightArmSprites.front; this.forwardLeftArm.sprite = cSprites_.leftArmSprites.front; this.forwardLegs.sprite = cSprites_.legSprites.front; //Setting the right side sprites this.rightSideHair.sprite = cSprites_.hairSprites.side; this.rightSideFacialHair.sprite = cSprites_.facialHairSprites.side; this.rightSideHead.sprite = cSprites_.headSprites.side; this.rightSideEye.sprite = cSprites_.eyeSprite; this.rightSideBody.sprite = cSprites_.bodySprites.side; this.rightSideRightArm.sprite = cSprites_.rightArmSprites.side; this.rightSideLeftArm.sprite = cSprites_.leftArmSprites.side; this.rightSideLegs.sprite = cSprites_.legSprites.side; //Setting the left side sprites this.leftSideHair.sprite = cSprites_.hairSprites.side; this.leftSideFacialHair.sprite = cSprites_.facialHairSprites.side; this.leftSideHead.sprite = cSprites_.headSprites.side; this.leftSideEye.sprite = cSprites_.eyeSprite; this.leftSideBody.sprite = cSprites_.bodySprites.side; this.leftSideRightArm.sprite = cSprites_.rightArmSprites.side; this.leftSideLeftArm.sprite = cSprites_.leftArmSprites.side; this.leftSideLegs.sprite = cSprites_.legSprites.side; //Setting the back sprites this.backHair.sprite = cSprites_.hairSprites.back; this.backHead.sprite = cSprites_.headSprites.back; this.backBody.sprite = cSprites_.bodySprites.back; this.backRightArm.sprite = cSprites_.rightArmSprites.side; this.backLeftArm.sprite = cSprites_.leftArmSprites.side; this.backLegs.sprite = cSprites_.legSprites.back; //Setting the hair color this.forwardHair.color = cSprites_.hairColor; this.leftSideHair.color = cSprites_.hairColor; this.rightSideHair.color = cSprites_.hairColor; this.backHair.color = cSprites_.hairColor; //Setting the facial hair color this.forwardFacialHair.color = cSprites_.facialHairColor; this.leftSideFacialHair.color = cSprites_.facialHairColor; this.rightSideFacialHair.color = cSprites_.facialHairColor; //Setting the forward sprite color this.forwardHead.color = cSprites_.skinColor; this.forwardBody.color = cSprites_.skinColor; this.forwardRightArm.color = cSprites_.skinColor; this.forwardLeftArm.color = cSprites_.skinColor; this.forwardLegs.color = cSprites_.skinColor; //Setting the back sprite color this.backHead.color = cSprites_.skinColor; this.backBody.color = cSprites_.skinColor; this.backRightArm.color = cSprites_.skinColor; this.backLeftArm.color = cSprites_.skinColor; this.backLegs.color = cSprites_.skinColor; //Setting the left side sprite color this.leftSideHead.color = cSprites_.skinColor; this.leftSideBody.color = cSprites_.skinColor; this.leftSideLeftArm.color = cSprites_.skinColor; this.leftSideRightArm.color = cSprites_.skinColor; this.leftSideLegs.color = cSprites_.skinColor; //Setting the right side sprite color this.rightSideHead.color = cSprites_.skinColor; this.rightSideBody.color = cSprites_.skinColor; this.rightSideRightArm.color = cSprites_.skinColor; this.rightSideLeftArm.color = cSprites_.skinColor; this.rightSideLegs.color = cSprites_.skinColor; //If the character inventory given isn't null, we set all of the character armor and weapon sprites if (characterInventory_ != null) { //Setting the helm sprites if a helm is equipped if (characterInventory_.helm != null) { this.forwardHelm.sprite = characterInventory_.helm.armorSpriteViews[0].front; this.backHelm.sprite = characterInventory_.helm.armorSpriteViews[0].back; this.rightSideHelm.sprite = characterInventory_.helm.armorSpriteViews[0].side; this.leftSideHelm.sprite = characterInventory_.helm.armorSpriteViews[0].side; //If this helm covers up the character's hair, we set the hair sprite to empty if (characterInventory_.helm.replaceCharacterSprite) { this.forwardHair.sprite = this.emptySprite; this.backHair.sprite = this.emptySprite; this.rightSideHair.sprite = this.emptySprite; this.leftSideHair.sprite = this.emptySprite; } } //If there is no helm, we set them to empty else { this.forwardHelm.sprite = this.emptySprite; this.backHelm.sprite = this.emptySprite; this.rightSideHelm.sprite = this.emptySprite; this.leftSideHelm.sprite = this.emptySprite; } //Setting the chestpiece sprites if a chestpiece is equipped if (characterInventory_.chestPiece != null) { //Looping through to find the correct sprite view to match our character's body type SpriteViews bodySpriteView = null; foreach (SpriteViews sv in characterInventory_.chestPiece.armorSpriteViews) { //If we find the correct sprite view for our body type if (sv.bodyType == cSprites_.bodySprites.bodyType) { //We set the sprite view and break the loop bodySpriteView = sv; break; } } //If we found a correct sprite view if (bodySpriteView != null) { this.forwardChestpiece.sprite = bodySpriteView.front; this.backChestpiece.sprite = bodySpriteView.back; this.rightSideChestpiece.sprite = bodySpriteView.side; this.leftSideChestpiece.sprite = bodySpriteView.side; //If this chestpiece covers up the character's torso, we hide them if (characterInventory_.chestPiece.replaceCharacterSprite) { this.forwardBody.sprite = this.emptySprite; this.backBody.sprite = this.emptySprite; this.rightSideBody.sprite = this.emptySprite; this.leftSideBody.sprite = this.emptySprite; } } //If we didn't find the correct sprite view else { Debug.LogError("ERROR! CharacterSpriteBase.SetSpriteImages, No valid body type for chestpiece"); //throw new System.Exception("ERROR! CharacterSpriteBase.SetSpriteImages, No valid body type for chestpiece"); } } //If there's no chestpiece, we set them to empty else { this.forwardChestpiece.sprite = this.emptySprite; this.backChestpiece.sprite = this.emptySprite; this.rightSideChestpiece.sprite = this.emptySprite; this.leftSideChestpiece.sprite = this.emptySprite; } //Setting the leggings sprites if leggings are equipped if (characterInventory_.leggings != null) { //Looping through to find the correct sprite view to match our character's body type SpriteViews legSpriteView = null; foreach (SpriteViews sv in characterInventory_.leggings.armorSpriteViews) { //If we find the correct sprite view for our body type if (sv.bodyType == cSprites_.legSprites.bodyType) { //We set the sprite view and break the loop legSpriteView = sv; break; } } //If we found a correct sprite view if (legSpriteView != null) { this.forwardLeggings.sprite = legSpriteView.front; this.backLeggings.sprite = legSpriteView.back; this.rightSideLeggings.sprite = legSpriteView.side; this.leftSideLeggings.sprite = legSpriteView.side; } //If we didn't find the correct sprite view else { throw new System.Exception("ERROR! CharacterSpriteBase.SetSpriteImages, No valid body type for leggings"); } } //If there's no leggings, we set them to empty else { this.forwardLeggings.sprite = this.emptySprite; this.backLeggings.sprite = this.emptySprite; this.rightSideLeggings.sprite = this.emptySprite; this.leftSideLeggings.sprite = this.emptySprite; } //Setting the shoe sprites if shoes are equipped if (characterInventory_.shoes != null) { //Looping through to find the correct sprite view to match our character's body type SpriteViews feetSpriteView = null; foreach (SpriteViews sv in characterInventory_.shoes.armorSpriteViews) { //If we find the correct sprite view for our body type if (sv.bodyType == cSprites_.legSprites.bodyType) { //We set the sprite view and break the loop feetSpriteView = sv; break; } } //If we found a correct sprite view if (feetSpriteView != null) { this.forwardShoes.sprite = feetSpriteView.front; this.backShoes.sprite = feetSpriteView.back; this.rightSideShoes.sprite = feetSpriteView.side; this.leftSideShoes.sprite = feetSpriteView.side; } //If we didn't find the correct sprite view else { throw new System.Exception("ERROR! CharacterSpriteBase.SetSpriteImages, No valid body type for shoes"); } } //If there's no shoes, we set them to empty else { this.forwardShoes.sprite = this.emptySprite; this.backShoes.sprite = this.emptySprite; this.rightSideShoes.sprite = this.emptySprite; this.leftSideShoes.sprite = this.emptySprite; } //Setting the glove sprites if gloves are equipped if (characterInventory_.gloves != null) { this.forwardRightGlove.sprite = characterInventory_.gloves.armorSpriteViews[0].front; this.backRightGlove.sprite = characterInventory_.gloves.armorSpriteViews[0].back; this.rightSideRightGlove.sprite = characterInventory_.gloves.armorSpriteViews[0].side; this.leftSideRightGlove.sprite = characterInventory_.gloves.armorSpriteViews[0].side; this.forwardLeftGlove.sprite = characterInventory_.gloves.armorSpriteViews[0].front; this.backLeftGlove.sprite = characterInventory_.gloves.armorSpriteViews[0].back; this.rightSideLeftGlove.sprite = characterInventory_.gloves.armorSpriteViews[0].side; this.leftSideLeftGlove.sprite = characterInventory_.gloves.armorSpriteViews[0].side; //If these gloves cover up the character's hands, we set the hand sprites to empty if (characterInventory_.gloves.replaceCharacterSprite) { this.forwardRightArm.sprite = this.emptySprite; this.backRightArm.sprite = this.emptySprite; this.rightSideRightArm.sprite = this.emptySprite; this.leftSideRightArm.sprite = this.emptySprite; this.forwardLeftArm.sprite = this.emptySprite; this.backLeftArm.sprite = this.emptySprite; this.rightSideLeftArm.sprite = this.emptySprite; this.leftSideLeftArm.sprite = this.emptySprite; } } //If there are no gloves, we set them to empty else { this.forwardRightGlove.sprite = this.emptySprite; this.backRightGlove.sprite = this.emptySprite; this.rightSideRightGlove.sprite = this.emptySprite; this.leftSideRightGlove.sprite = this.emptySprite; this.forwardLeftGlove.sprite = this.emptySprite; this.backLeftGlove.sprite = this.emptySprite; this.rightSideLeftGlove.sprite = this.emptySprite; this.leftSideLeftGlove.sprite = this.emptySprite; } //Setting the cloak sprites if a cloak is equipped if (characterInventory_.cloak != null) { this.forwardCloak.sprite = characterInventory_.cloak.armorSpriteViews[0].front; this.backCloak.sprite = characterInventory_.cloak.armorSpriteViews[0].back; this.rightSideCloak.sprite = characterInventory_.cloak.armorSpriteViews[0].side; this.leftSideCloak.sprite = characterInventory_.cloak.armorSpriteViews[0].side; } //If there is no cloak, we set them to empty else { this.forwardCloak.sprite = this.emptySprite; this.backCloak.sprite = this.emptySprite; this.rightSideCloak.sprite = this.emptySprite; this.leftSideCloak.sprite = this.emptySprite; } //Setting the right hand weapon sprites if there's a weapon equipped in that hand if (characterInventory_.rightHand != null) { //If the weapon sprite overlaps the character's hand (like if it's a shield or wrist claw) if (characterInventory_.rightHand.overlapCharacterHand) { this.forwardRightWeapon.sprite = this.emptySprite; this.backRightWeapon.sprite = characterInventory_.rightHand.weaponSpriteViews.back; this.rightSideRightWeapon.sprite = this.emptySprite; this.leftSideRightWeapon.sprite = characterInventory_.rightHand.weaponSpriteViews.side; this.forwardRightWeaponOverlap.sprite = characterInventory_.rightHand.weaponSpriteViews.front; this.rightSideRightWeaponOverlap.sprite = characterInventory_.rightHand.weaponSpriteViews.side; //If the weapon has a reverse view if (characterInventory_.rightHand.reverseView != null) { this.leftSideRightWeapon.sprite = characterInventory_.rightHand.reverseView; } } //If the weapon doesn't overlap the character hand else { this.forwardRightWeapon.sprite = characterInventory_.rightHand.weaponSpriteViews.front; this.backRightWeapon.sprite = characterInventory_.rightHand.weaponSpriteViews.back; this.rightSideRightWeapon.sprite = characterInventory_.rightHand.weaponSpriteViews.side; this.leftSideRightWeapon.sprite = characterInventory_.rightHand.weaponSpriteViews.side; this.forwardRightWeaponOverlap.sprite = this.emptySprite; this.rightSideRightWeaponOverlap.sprite = this.emptySprite; //If the weapon has a reverse view if (characterInventory_.rightHand.reverseView != null) { this.leftSideRightWeapon.sprite = characterInventory_.rightHand.reverseView; } } } //If there is no weapon, we set them to empty else { this.forwardRightWeapon.sprite = this.emptySprite; this.backRightWeapon.sprite = this.emptySprite; this.rightSideRightWeapon.sprite = this.emptySprite; this.leftSideRightWeapon.sprite = this.emptySprite; this.forwardRightWeaponOverlap.sprite = this.emptySprite; this.rightSideRightWeaponOverlap.sprite = this.emptySprite; } //Setting the left hand weapon sprites if there's a weapon equipped in that hand if (characterInventory_.leftHand != null) { //If the weapon sprite overlaps the character's hand (like if it's a shield or wrist claw) if (characterInventory_.leftHand.overlapCharacterHand) { this.forwardLeftWeapon.sprite = this.emptySprite; this.backLeftWeapon.sprite = characterInventory_.leftHand.weaponSpriteViews.back; this.rightSideLeftWeapon.sprite = characterInventory_.leftHand.weaponSpriteViews.side; this.leftSideLeftWeapon.sprite = this.emptySprite; this.forwardLeftWeaponOverlap.sprite = characterInventory_.leftHand.weaponSpriteViews.front; this.leftSideLeftWeaponOverlap.sprite = characterInventory_.leftHand.weaponSpriteViews.side; //If the weapon has a reverse view if (characterInventory_.leftHand.reverseView != null) { this.rightSideLeftWeapon.sprite = characterInventory_.leftHand.reverseView; } } //If the weapon doesn't overlap the character hand else { this.forwardLeftWeapon.sprite = characterInventory_.leftHand.weaponSpriteViews.front; this.backLeftWeapon.sprite = characterInventory_.leftHand.weaponSpriteViews.back; this.rightSideLeftWeapon.sprite = characterInventory_.leftHand.weaponSpriteViews.side; this.leftSideLeftWeapon.sprite = characterInventory_.leftHand.weaponSpriteViews.side; this.forwardLeftWeaponOverlap.sprite = this.emptySprite; this.leftSideLeftWeaponOverlap.sprite = this.emptySprite; //If the weapon has a reverse view if (characterInventory_.leftHand.reverseView != null) { this.rightSideLeftWeapon.sprite = characterInventory_.leftHand.reverseView; } } } //If there is no weapon, we set them to empty else { this.forwardLeftWeapon.sprite = this.emptySprite; this.backLeftWeapon.sprite = this.emptySprite; this.rightSideLeftWeapon.sprite = this.emptySprite; this.leftSideLeftWeapon.sprite = this.emptySprite; this.forwardLeftWeaponOverlap.sprite = this.emptySprite; this.leftSideLeftWeaponOverlap.sprite = this.emptySprite; } } //If there's no character inventory given, all of the armor sprites are empty else { //Setting the helms this.forwardHelm.sprite = this.emptySprite; this.backHelm.sprite = this.emptySprite; this.rightSideHelm.sprite = this.emptySprite; this.leftSideHelm.sprite = this.emptySprite; //Setting the chestpieces this.forwardChestpiece.sprite = this.emptySprite; this.backChestpiece.sprite = this.emptySprite; this.rightSideChestpiece.sprite = this.emptySprite; this.leftSideChestpiece.sprite = this.emptySprite; //Setting the leggings this.forwardLeggings.sprite = this.emptySprite; this.backLeggings.sprite = this.emptySprite; this.rightSideLeggings.sprite = this.emptySprite; this.leftSideLeggings.sprite = this.emptySprite; //Setting the shoes this.forwardShoes.sprite = this.emptySprite; this.backShoes.sprite = this.emptySprite; this.rightSideShoes.sprite = this.emptySprite; this.leftSideShoes.sprite = this.emptySprite; //Setting the right gloves this.forwardRightGlove.sprite = this.emptySprite; this.backRightGlove.sprite = this.emptySprite; this.rightSideRightGlove.sprite = this.emptySprite; this.leftSideRightGlove.sprite = this.emptySprite; //Setting the left gloves this.forwardLeftGlove.sprite = this.emptySprite; this.backLeftGlove.sprite = this.emptySprite; this.rightSideLeftGlove.sprite = this.emptySprite; this.leftSideLeftGlove.sprite = this.emptySprite; //Setting the cloaks this.forwardCloak.sprite = this.emptySprite; this.backCloak.sprite = this.emptySprite; this.rightSideCloak.sprite = this.emptySprite; this.leftSideCloak.sprite = this.emptySprite; //Setting the right hand weapons this.forwardRightWeapon.sprite = this.emptySprite; this.backRightWeapon.sprite = this.emptySprite; this.rightSideRightWeapon.sprite = this.emptySprite; this.leftSideRightWeapon.sprite = this.emptySprite; this.forwardRightWeaponOverlap.sprite = this.emptySprite; this.rightSideRightWeaponOverlap.sprite = this.emptySprite; //Setting the left hand weapons this.forwardLeftWeapon.sprite = this.emptySprite; this.backLeftWeapon.sprite = this.emptySprite; this.rightSideLeftWeapon.sprite = this.emptySprite; this.leftSideLeftWeapon.sprite = this.emptySprite; this.forwardLeftWeaponOverlap.sprite = this.emptySprite; this.leftSideLeftWeaponOverlap.sprite = this.emptySprite; } }
//Function called from OnGUI to assign shoe sprites private void AssignShoeSprites(string spritePrefix_) { //If we don't have a shoe armor item, nothing happens if (this.shoes == null || this.shoes.slot != Armor.ArmorSlot.Feet) { return; } //Creating a new list of all of the sprite views this.shoes.armorSpriteViews = new List <SpriteViews>(); //Going through each type of leg sprite and assigning the shoe for it SpriteViews shoe0 = this.GetAllSpriteViews(spritePrefix_, 14, 80, 14, BodyTypes.LegsSkinny1); this.shoes.armorSpriteViews.Add(shoe0); SpriteViews shoe1 = this.GetAllSpriteViews(spritePrefix_, 14, 80, 14, BodyTypes.LegsSkinny2); this.shoes.armorSpriteViews.Add(shoe1); SpriteViews shoe2 = this.GetAllSpriteViews(spritePrefix_, 14, 80, 14, BodyTypes.LegsSkinny3); this.shoes.armorSpriteViews.Add(shoe2); SpriteViews shoe3 = this.GetAllSpriteViews(spritePrefix_, 17, 80, 17, BodyTypes.LegsSkinny4); this.shoes.armorSpriteViews.Add(shoe3); SpriteViews shoe4 = this.GetAllSpriteViews(spritePrefix_, 17, 80, 17, BodyTypes.LegsSkinny5); this.shoes.armorSpriteViews.Add(shoe4); SpriteViews shoe5 = this.GetAllSpriteViews(spritePrefix_, 17, 80, 17, BodyTypes.LegsSkinny6); this.shoes.armorSpriteViews.Add(shoe5); SpriteViews shoe6 = this.GetAllSpriteViews(spritePrefix_, 14, 102, 14, BodyTypes.LegsNormal1); this.shoes.armorSpriteViews.Add(shoe6); SpriteViews shoe7 = this.GetAllSpriteViews(spritePrefix_, 14, 102, 14, BodyTypes.LegsNormal2); this.shoes.armorSpriteViews.Add(shoe7); SpriteViews shoe8 = this.GetAllSpriteViews(spritePrefix_, 14, 102, 14, BodyTypes.LegsNormal3); this.shoes.armorSpriteViews.Add(shoe8); SpriteViews shoe9 = this.GetAllSpriteViews(spritePrefix_, 17, 102, 17, BodyTypes.LegsNormal4); this.shoes.armorSpriteViews.Add(shoe9); SpriteViews shoe10 = this.GetAllSpriteViews(spritePrefix_, 17, 102, 17, BodyTypes.LegsNormal5); this.shoes.armorSpriteViews.Add(shoe10); SpriteViews shoe11 = this.GetAllSpriteViews(spritePrefix_, 17, 102, 17, BodyTypes.LegsNormal6); this.shoes.armorSpriteViews.Add(shoe11); SpriteViews shoe12 = this.GetAllSpriteViews(spritePrefix_, 17, 124, 17, BodyTypes.LegsFat1); this.shoes.armorSpriteViews.Add(shoe12); SpriteViews shoe13 = this.GetAllSpriteViews(spritePrefix_, 17, 124, 17, BodyTypes.LegsFat2); this.shoes.armorSpriteViews.Add(shoe13); SpriteViews shoe14 = this.GetAllSpriteViews(spritePrefix_, 17, 124, 17, BodyTypes.LegsFat3); this.shoes.armorSpriteViews.Add(shoe14); SpriteViews shoe15 = this.GetAllSpriteViews(spritePrefix_, 17, 127, 17, BodyTypes.LegsFat4); this.shoes.armorSpriteViews.Add(shoe15); SpriteViews shoe16 = this.GetAllSpriteViews(spritePrefix_, 17, 127, 17, BodyTypes.LegsFat5); this.shoes.armorSpriteViews.Add(shoe16); SpriteViews shoe17 = this.GetAllSpriteViews(spritePrefix_, 17, 127, 17, BodyTypes.LegsFat6); this.shoes.armorSpriteViews.Add(shoe17); //Setting this shoe object to dirty so that it saves the changes Undo.RecordObject(this.shoes, "Set Shoe Sprites"); EditorUtility.SetDirty(this.shoes); }
//Function called from OnGUI to assign legging sprites private void AssignLeggingSprites(string spritePrefix_) { //If we don't have a leg armor item, nothing happens if (leggings == null || leggings.slot != Armor.ArmorSlot.Legs) { return; } //Creating a new list of all of the sprite views this.leggings.armorSpriteViews = new List <SpriteViews>(); //Going through each of the leg sprites and assigning the leggings for them SpriteViews legs0 = this.GetAllSpriteViews(spritePrefix_, 8, 74, 8, BodyTypes.LegsSkinny1); this.leggings.armorSpriteViews.Add(legs0); SpriteViews legs1 = this.GetAllSpriteViews(spritePrefix_, 9, 75, 9, BodyTypes.LegsSkinny2); this.leggings.armorSpriteViews.Add(legs1); SpriteViews legs2 = this.GetAllSpriteViews(spritePrefix_, 10, 76, 10, BodyTypes.LegsSkinny3); this.leggings.armorSpriteViews.Add(legs2); SpriteViews legs3 = this.GetAllSpriteViews(spritePrefix_, 11, 77, 11, BodyTypes.LegsSkinny4); this.leggings.armorSpriteViews.Add(legs3); SpriteViews legs4 = this.GetAllSpriteViews(spritePrefix_, 12, 78, 12, BodyTypes.LegsSkinny5); this.leggings.armorSpriteViews.Add(legs4); SpriteViews legs5 = this.GetAllSpriteViews(spritePrefix_, 13, 79, 13, BodyTypes.LegsSkinny6); this.leggings.armorSpriteViews.Add(legs5); SpriteViews legs6 = this.GetAllSpriteViews(spritePrefix_, 30, 96, 30, BodyTypes.LegsNormal1); this.leggings.armorSpriteViews.Add(legs6); SpriteViews legs7 = this.GetAllSpriteViews(spritePrefix_, 31, 97, 31, BodyTypes.LegsNormal2); this.leggings.armorSpriteViews.Add(legs7); SpriteViews legs8 = this.GetAllSpriteViews(spritePrefix_, 32, 98, 32, BodyTypes.LegsNormal3); this.leggings.armorSpriteViews.Add(legs8); SpriteViews legs9 = this.GetAllSpriteViews(spritePrefix_, 33, 99, 33, BodyTypes.LegsNormal4); this.leggings.armorSpriteViews.Add(legs9); SpriteViews legs10 = this.GetAllSpriteViews(spritePrefix_, 34, 100, 34, BodyTypes.LegsNormal5); this.leggings.armorSpriteViews.Add(legs10); SpriteViews legs11 = this.GetAllSpriteViews(spritePrefix_, 34, 101, 35, BodyTypes.LegsNormal6); this.leggings.armorSpriteViews.Add(legs11); SpriteViews legs12 = this.GetAllSpriteViews(spritePrefix_, 52, 118, 52, BodyTypes.LegsFat1); this.leggings.armorSpriteViews.Add(legs12); SpriteViews legs13 = this.GetAllSpriteViews(spritePrefix_, 53, 119, 53, BodyTypes.LegsFat2); this.leggings.armorSpriteViews.Add(legs13); SpriteViews legs14 = this.GetAllSpriteViews(spritePrefix_, 54, 120, 54, BodyTypes.LegsFat3); this.leggings.armorSpriteViews.Add(legs14); SpriteViews legs15 = this.GetAllSpriteViews(spritePrefix_, 55, 121, 55, BodyTypes.LegsFat4); this.leggings.armorSpriteViews.Add(legs15); SpriteViews legs16 = this.GetAllSpriteViews(spritePrefix_, 56, 122, 56, BodyTypes.LegsFat5); this.leggings.armorSpriteViews.Add(legs16); SpriteViews legs17 = this.GetAllSpriteViews(spritePrefix_, 57, 123, 57, BodyTypes.LegsFat6); this.leggings.armorSpriteViews.Add(legs17); //Setting this legging object to dirty so that it saves the changes Undo.RecordObject(this.leggings, "Set Legging Sprites"); EditorUtility.SetDirty(this.leggings); }
//Function called from OnGUI to assign chestpiece sprites private void AssignChestpieceSprites(string spritePrefix_) { //If we don't have a chest armor item, nothing happens if (chestpiece == null || chestpiece.slot != Armor.ArmorSlot.Torso) { return; } //Creating a new list of all of the sprite views this.chestpiece.armorSpriteViews = new List <SpriteViews>(); //Assigning the chest sprites SpriteViews chest0 = this.GetAllSpriteViews(spritePrefix_, 22, 0, 44, BodyTypes.TorsoSkinnyShortMale); this.chestpiece.armorSpriteViews.Add(chest0); SpriteViews chest1 = this.GetAllSpriteViews(spritePrefix_, 23, 1, 45, BodyTypes.TorsoBuffShortMale); this.chestpiece.armorSpriteViews.Add(chest1); SpriteViews chest2 = this.GetAllSpriteViews(spritePrefix_, 24, 2, 46, BodyTypes.TorsoFatShortMale); this.chestpiece.armorSpriteViews.Add(chest2); SpriteViews chest3 = this.GetAllSpriteViews(spritePrefix_, 25, 3, 47, BodyTypes.TorsoObeseShortMale); this.chestpiece.armorSpriteViews.Add(chest3); SpriteViews chest4 = this.GetAllSpriteViews(spritePrefix_, 26, 4, 48, BodyTypes.TorsoSkinnyShortFemale); this.chestpiece.armorSpriteViews.Add(chest4); SpriteViews chest5 = this.GetAllSpriteViews(spritePrefix_, 27, 5, 49, BodyTypes.TorsoBuffShortFemale); this.chestpiece.armorSpriteViews.Add(chest5); SpriteViews chest6 = this.GetAllSpriteViews(spritePrefix_, 28, 6, 50, BodyTypes.TorsoFatShortFemale); this.chestpiece.armorSpriteViews.Add(chest6); SpriteViews chest7 = this.GetAllSpriteViews(spritePrefix_, 29, 7, 51, BodyTypes.TorsoObeseShortFemale); this.chestpiece.armorSpriteViews.Add(chest7); SpriteViews chest8 = this.GetAllSpriteViews(spritePrefix_, 88, 66, 110, BodyTypes.TorsoSkinnyTallMale); this.chestpiece.armorSpriteViews.Add(chest8); SpriteViews chest9 = this.GetAllSpriteViews(spritePrefix_, 89, 67, 111, BodyTypes.TorsoBuffTallMale); this.chestpiece.armorSpriteViews.Add(chest9); SpriteViews chest10 = this.GetAllSpriteViews(spritePrefix_, 90, 68, 112, BodyTypes.TorsoFatTallMale); this.chestpiece.armorSpriteViews.Add(chest10); SpriteViews chest11 = this.GetAllSpriteViews(spritePrefix_, 91, 69, 113, BodyTypes.TorsoObeseTallMale); this.chestpiece.armorSpriteViews.Add(chest11); SpriteViews chest12 = this.GetAllSpriteViews(spritePrefix_, 92, 70, 114, BodyTypes.TorsoSkinnyTallFemale); this.chestpiece.armorSpriteViews.Add(chest12); SpriteViews chest13 = this.GetAllSpriteViews(spritePrefix_, 93, 71, 115, BodyTypes.TorsoBuffTallFemale); this.chestpiece.armorSpriteViews.Add(chest13); SpriteViews chest14 = this.GetAllSpriteViews(spritePrefix_, 94, 72, 116, BodyTypes.TorsoFatTallFemale); this.chestpiece.armorSpriteViews.Add(chest14); SpriteViews chest15 = this.GetAllSpriteViews(spritePrefix_, 95, 73, 117, BodyTypes.TorsoObeseTallFemale); this.chestpiece.armorSpriteViews.Add(chest15); //Setting this chestpiece object to dirty so that it saves the changes Undo.RecordObject(this.chestpiece, "Set Chestpiece Sprites"); EditorUtility.SetDirty(this.chestpiece); }