void LoadAvailableCharacterColors() { string dataPath = UsefulPath.characterColorData + "CharacterColorList" + ".asset"; CharacterColors colorListData = (CharacterColors)AssetDatabase.LoadAssetAtPath(dataPath, typeof(CharacterColors)); colorList = colorListData.colorsList; }
void SetColor() { var swap = GetComponent <SwapTextureFromImage> (); swap.targetColors = CharacterColors.GetPalette(0); swap.swapColors = CharacterColors.GetPalette(PlayerColorIndex); }
private void SetColors() { characterColors = new CharacterColors[numColors]; characterColors[0] = new CharacterColors(new Color(0.5882f, 0.733f, 1f), new Color(0.8196f, 0.69f, 0.4706f), new Color(0.3608f, 0.498f, 0.7451f)); characterColors[1] = new CharacterColors(new Color(0.9176f, 0.4392f, 0.5255f), new Color(0.3804f, 0.6588f, 0.7686f), new Color(0.7176f, 0.1373f, 0.2392f)); characterColors[2] = new CharacterColors(new Color(0.498f, 0.8275f, 0.5686f), new Color(0.4745f, 0.3255f, 0.2627f), new Color(0.2f, 0.5373f, 0.2745f)); characterColors[3] = new CharacterColors(new Color(1.0f, 0.9412f, 0.5843f), new Color(0.3569f, 0.2941f, 0.498f), new Color(0.9176f, 0.8078f, 0.2392f)); characterColors[4] = new CharacterColors(new Color(0.6902f, 0.5216f, 0.9961f), new Color(0.2118f, 0.1647f, 0.498f), new Color(0.5216f, 0.2863f, 0.9569f)); characterColors[5] = new CharacterColors(new Color(1.0f, 0.8471f, 0.9804f), new Color(0.1882f, 0.4471f, 0.2471f), new Color(0.9725f, 0.6157f, 0.9333f)); }
public void SetColor(CharacterColors newColor) { var mrList = _characterPrafab.GetComponentsInChildren <SkinnedMeshRenderer>(); foreach (var mr in mrList) { mr.material = _colorMaterials[(int)newColor]; } MyColor = newColor; }
public CharacterSheet(AbilityScores abilityScore, PersonalInformation personalInfo, CharacterProgress characterProg, CombatScores cScores, SkillScores sScores, CharacterColors characterColors, Character character, CharacterLoadout loadout) { abilityScores = abilityScore; personalInformation = personalInfo; characterProgress = characterProg; combatScores = cScores; skillScores = sScores; inventory = new Inventory(); inventory.character = character; this.characterColors = characterColors; characterLoadout = new CharacterLoadoutActual(loadout, character, characterColors); // Character Armor // Character Inventory }
PlayerInput CreatePlayer(PlayerInputConfiguration configuration) { if (players.Count < maxPlayers) { var playerPosition = playerPositions[configuration.PlayerColorIndex]; var gameObject = (GameObject)Instantiate(playerPrefabs[configuration.PlayerColorIndex], playerPosition, Quaternion.identity); var swap = gameObject.GetComponent <SwapTexture> (); swap.swapColors = CharacterColors.GetPalette(configuration.PlayerColorIndex); var player = gameObject.GetComponent <PlayerInput>(); player.Actions = configuration.Actions; players.Add(player); gameObject.name = "Player" + configuration.PlayerSuffix; player.PlayerSuffix = configuration.PlayerSuffix; return(player); } return(null); }
public CharacterLoadoutActual(CharacterLoadout loadout, Character character, CharacterColors colors) : this() { this.character = character; if (loadout == null) { return; } if (loadout.headSlot) { setItemInSlot(InventorySlot.Head, loadout.headSlot.getArmor(), colors); } if (loadout.chestSlot) { setItemInSlot(InventorySlot.Chest, loadout.chestSlot.getArmor(), colors); } if (loadout.gloveSlot) { setItemInSlot(InventorySlot.Glove, loadout.gloveSlot.getArmor(), colors); } if (loadout.pantsSlot) { setItemInSlot(InventorySlot.Pants, loadout.pantsSlot.getArmor(), colors); } if (loadout.bootsSlot) { setItemInSlot(InventorySlot.Boots, loadout.bootsSlot.getArmor(), colors); } if (loadout.rightHand) { setItemInSlot(InventorySlot.RightHand, loadout.rightHand.getWeapon(), colors); } if (loadout.leftHand) { setItemInSlot(InventorySlot.LeftHand, loadout.leftHand.getWeapon(), colors); } if (loadout.shoulderSlot) { setItemInSlot(InventorySlot.Shoulder, loadout.shoulderSlot.getItem(), colors); } }
public void loadCharacter(string firstName, string lastName, CharacterSex mCSex, CharacterRace mCRace, int age, CharacterBackground mCBackground, int height, int weight, CharacterClass mCClass, int mCSturdy, int mCPerception, int mCTechnique, int mCWellVersed, Color characterColor, Color headColor, Color primaryColor, Color secondaryColor, CharacterHairStyle hairStyle) { int heightRemainder = height % 12; height -= heightRemainder; personalInfo = new PersonalInformation(new CharacterName(firstName, lastName), mCSex, mCRace, mCBackground, new CharacterAge(age), new CharacterHeight(height, heightRemainder), new CharacterWeight(weight), hairStyle); characterProgress = new CharacterProgress(mCClass); abilityScores = new AbilityScores(mCSturdy, mCPerception, mCTechnique, mCWellVersed); combatScores = new CombatScores(abilityScores, personalInfo, characterProgress); skillScores = new SkillScores(combatScores, characterProgress); CharacterColors characterColors = new CharacterColors(characterColor, headColor, primaryColor, secondaryColor); characterSheet = new CharacterSheet(abilityScores, personalInfo, characterProgress, combatScores, skillScores, characterColors, this, characterLoadout); }
public void setItemInSlot(InventorySlot itemSlot, Item item, CharacterColors colors = null) { if (itemSlot == InventorySlot.None) { return; } removeSprite(getItemInSlot(itemSlot)); if (item != null && item.spritePrefab != null && character != null && character.unit != null) { if (colors == null) { colors = character.characterSheet.characterColors; } GameObject sprite = GameObject.Instantiate(item.spritePrefab) as GameObject; SpriteRenderer sr = sprite.GetComponent <SpriteRenderer>(); switch (itemSlot) { case InventorySlot.Head: case InventorySlot.Chest: sr.color = colors.primaryColor; break; case InventorySlot.Boots: // sr.color = new Color(.4f,.8f,.2f); break; case InventorySlot.Pants: sr.color = colors.secondaryColor; break; default: break; } item.sprite = sprite; sprite.transform.parent = character.unit.transform; sprite.transform.localPosition = new Vector3(0, 0, 0); sprite.transform.localEulerAngles = new Vector3(0, 0, 0); sprites.Add(new SpriteOrder(item.sprite, getOrder(itemSlot))); if (MapGenerator.mg != null && MapGenerator.mg.isInPriority()) { SetRenderQueue.setRendererQueue(sr.renderer, new int[] { 1000 }); } } switch (itemSlot) { case InventorySlot.Head: headSlot = (Armor)item; break; case InventorySlot.Chest: chestSlot = (Armor)item; break; case InventorySlot.Glove: gloveSlot = (Armor)item; break; case InventorySlot.Pants: pantsSlot = (Armor)item; break; case InventorySlot.Boots: bootsSlot = (Armor)item; break; case InventorySlot.RightHand: rightHand = (Weapon)item; break; case InventorySlot.LeftHand: leftHand = (Weapon)item; break; case InventorySlot.Shoulder: shoulderSlot = item; break; } }
void InitData() { colorList = (CharacterColors)ScriptableObject.CreateInstance(typeof(CharacterColors)); }
public string getCharacterString() { string characterStr = ""; //********PERSONAL INFORMATION********\\ //Adding player first name. characterStr += personalInfo.getCharacterName().firstName + delimiter; characterStr += personalInfo.getCharacterName().lastName + delimiter; CharacterSex sex = personalInfo.getCharacterSex(); characterStr += (sex == CharacterSex.Male ? 0 : (sex == CharacterSex.Female ? 1 : 2)) + delimiter; RaceName race = personalInfo.getCharacterRace().raceName; characterStr += (race == RaceName.Berrind ? 0 : (race == RaceName.Ashpian ? 1 : 2)) + delimiter; CharacterBackground background = personalInfo.getCharacterBackground(); characterStr += (background == CharacterBackground.FallenNoble || background == CharacterBackground.Commoner || background == CharacterBackground.Servant ? 0 : 1) + delimiter; characterStr += personalInfo.getCharacterAge().age + delimiter; characterStr += (personalInfo.getCharacterHeight().feet * 12 + personalInfo.getCharacterHeight().inches) + delimiter; characterStr += personalInfo.getCharacterWeight().weight + delimiter; ClassName clas = characterProgress.getCharacterClass().getClassName(); characterStr += (clas == ClassName.ExSoldier ? 0 : (clas == ClassName.Engineer ? 1 : (clas == ClassName.Investigator ? 2 : (clas == ClassName.Researcher ? 3 : 4)))) + delimiter; characterStr += abilityScores.getSturdy() + delimiter; characterStr += abilityScores.getPerception(0) + delimiter; characterStr += abilityScores.getTechnique() + delimiter; characterStr += abilityScores.getWellVersed() + delimiter; foreach (int score in skillScores.scores) { characterStr += score + delimiter; } CharacterColors colors = characterSheet.characterColors; characterStr += colorString(colors.characterColor); characterStr += colorString(colors.headColor); characterStr += colorString(colors.primaryColor); characterStr += colorString(colors.secondaryColor); characterStr += characterSheet.personalInformation.getCharacterHairStyle().hairStyle + delimiter; characterStr += characterProgress.getCharacterLevel() + delimiter; characterStr += characterProgress.getCharacterExperience() + delimiter; //*********Hair*********\\ characterStr += characterSheet.inventory.purse.money + delimiter; characterStr += characterSheet.combatScores.getCurrentHealth() + delimiter; characterStr += characterSheet.combatScores.getCurrentComposure() + delimiter; int[] features = characterSheet.characterProgress.getCharacterClass().chosenFeatures; characterStr += features.Length + delimiter; foreach (int feature in features) { characterStr += feature + delimiter; } characterStr += characterSheet.characterProgress.getWeaponFocusAsNumber() + delimiter; string inventoryString = ""; int inventorySize = 0; foreach (InventoryItemSlot slot in characterSheet.inventory.inventory) { if (slot.item != null) { inventorySize++; inventoryString += slot.index + delimiter; inventoryString += (int)slot.item.getItemCode() + delimiter; inventoryString += slot.item.getItemData() + delimiter; if (slot.item.stackSize() > 0) { foreach (Item i in slot.item.stack) { inventorySize++; inventoryString += slot.index + delimiter; inventoryString += (int)i.getItemCode() + delimiter; inventoryString += i.getItemData() + delimiter; } } } } foreach (InventorySlot slot in UnitGUI.armorSlots) { Item i = characterSheet.characterLoadout.getItemInSlot(slot); if (i != null) { // if (characterSheet.personalInformation.getCharacterName().firstName == "v") Debug.Log("GUI Slot: " + slot + " " + (i is Weapon) + " " + (i is Medicinal)); inventorySize++; inventoryString += getArmorSlotIndex(slot) + delimiter; inventoryString += (int)i.getItemCode() + delimiter; inventoryString += i.getItemData() + delimiter; } } characterStr += inventorySize + delimiter + inventoryString; characterStr += characterSheet.characterProgress.getFavoredRaceAsNumber() + delimiter; return(characterStr); }
public void loadCharacterFromTextFile(string fileName) { // TextAsset text = Resources.Load<TextAsset>("Saves/" + fileName); // string data = text.text; string data = Saves.getCharactersString(fileName); string[] components = data.Split(new char[] { ';' }); int curr = 0; string firstName = components[curr++]; string lastName = components[curr++]; int sex = int.Parse(components[curr++]); CharacterSex sexC = (sex == 0 ? CharacterSex.Male : (sex == 1 ? CharacterSex.Female : CharacterSex.Other)); int race = int.Parse(components[curr++]); CharacterRace raceC = CharacterRace.getRace(race == 0 ? RaceName.Berrind : (race == 1 ? RaceName.Ashpian : RaceName.Rorrul)); int background = int.Parse(components[curr++]); CharacterBackground backgroundC = (background == 0 ? (race == 0 ? CharacterBackground.FallenNoble : (race == 1 ? CharacterBackground.Commoner : CharacterBackground.Servant)) : (race == 0 ? CharacterBackground.WhiteGem : (race == 1 ? CharacterBackground.Immigrant : CharacterBackground.Unknown))); int age = int.Parse(components[curr++]); int height = int.Parse(components[curr++]); int weight = int.Parse(components[curr++]); int class1 = int.Parse(components[curr++]); ClassName className = (class1 == 0 ? ClassName.ExSoldier : (class1 == 1 ? ClassName.Engineer : (class1 == 2 ? ClassName.Investigator : (class1 == 3 ? ClassName.Researcher : ClassName.Orator)))); int sturdy = int.Parse(components[curr++]); int perception = int.Parse(components[curr++]); int technique = int.Parse(components[curr++]); int wellVersed = int.Parse(components[curr++]); int athletics = int.Parse(components[curr++]); int melee = int.Parse(components[curr++]); int ranged = int.Parse(components[curr++]); int stealth = int.Parse(components[curr++]); int mechanical = int.Parse(components[curr++]); int medicinal = int.Parse(components[curr++]); int historical = int.Parse(components[curr++]); int political = int.Parse(components[curr++]); Color characterColor = new Color(int.Parse(components[curr++]) / 255.0f, int.Parse(components[curr++]) / 255.0f, int.Parse(components[curr++]) / 255.0f); Debug.Log(characterColor.r + " " + characterColor.g + " " + characterColor.b); Color headColor = new Color(int.Parse(components[curr++]) / 255.0f, int.Parse(components[curr++]) / 255.0f, int.Parse(components[curr++]) / 255.0f); Color primaryColor = new Color(int.Parse(components[curr++]) / 255.0f, int.Parse(components[curr++]) / 255.0f, int.Parse(components[curr++]) / 255.0f); Color secondaryColor = new Color(int.Parse(components[curr++]) / 255.0f, int.Parse(components[curr++]) / 255.0f, int.Parse(components[curr++]) / 255.0f); int hairStyle = 0; int level = 1; int experience = 0; if (curr < components.Length - 1) { hairStyle = int.Parse(components[curr++]); } if (curr < components.Length - 1) { level = int.Parse(components[curr++]); } if (curr < components.Length - 1) { experience = int.Parse(components[curr++]); } int money = 0; int health = 100000; int composure = 100000; int numFeatures = 0; int numItems = 0; int focus = 0; if (curr < components.Length - 1) { money = int.Parse(components[curr++]); } if (curr < components.Length - 1) { health = int.Parse(components[curr++]); } if (curr < components.Length - 1) { composure = int.Parse(components[curr++]); } if (curr < components.Length - 1) { numFeatures = int.Parse(components[curr++]); } int[] features = new int[numFeatures]; for (int n = 0; n < numFeatures; n++) { if (curr < components.Length - 1) { features[n] = int.Parse(components[curr++]); } } if (curr < components.Length - 1) { focus = int.Parse(components[curr++]); } if (curr < components.Length - 1) { numItems = int.Parse(components[curr++]); } personalInfo = new PersonalInformation(new CharacterName(firstName, lastName), sexC, raceC, backgroundC, new CharacterAge(age), new CharacterHeight(height), new CharacterWeight(weight), new CharacterHairStyle(hairStyle)); characterProgress = new CharacterProgress(CharacterClass.getClass(className)); abilityScores = new AbilityScores(sturdy, perception, technique, wellVersed); combatScores = new CombatScores(abilityScores, personalInfo, characterProgress); skillScores = new SkillScores(combatScores, characterProgress); CharacterColors characterColors = new CharacterColors(characterColor, headColor, primaryColor, secondaryColor); characterSheet = new CharacterSheet(abilityScores, personalInfo, characterProgress, combatScores, skillScores, characterColors, this, characterLoadout); skillScores.incrementScore(Skill.Athletics, athletics); skillScores.incrementScore(Skill.Melee, melee); skillScores.incrementScore(Skill.Ranged, ranged); skillScores.incrementScore(Skill.Stealth, stealth); skillScores.incrementScore(Skill.Mechanical, mechanical); skillScores.incrementScore(Skill.Medicinal, medicinal); skillScores.incrementScore(Skill.Historical, historical); skillScores.incrementScore(Skill.Political, political); characterProgress.setLevel(level); characterProgress.setExperience(experience); characterSheet.inventory.purse.receiveMoney(money); combatScores.setHealth(health); combatScores.setComposure(composure); characterProgress.getCharacterClass().chosenFeatures = features; characterProgress.setWeaponFocus(focus); Inventory inv = characterSheet.inventory; for (int n = 0; n < numItems; n++) { int slot = int.Parse(components[curr++]); ItemCode code = (ItemCode)int.Parse(components[curr++]); string itemData = components[curr++]; Item i = Item.deserializeItem(code, itemData); if (slot < 100) { if (inv.inventory[slot].item != null) { if (inv.itemCanStackWith(inv.inventory[slot].item, i)) { inv.inventory[slot].item.addToStack(i); } } else if (inv.canInsertItemInSlot(i, Inventory.getSlotForIndex(slot))) { inv.insertItemInSlot(i, Inventory.getSlotForIndex(slot)); } } else { characterSheet.characterLoadout.setItemInSlot(getArmorSlot(slot), i); } //Inventory stuff } //Right Weapon = 100; //Left Weapon = 110; //Head = 120; //Shoulder = 130; //Chest = 140; //Legs = 150; //Boots = 160; //Gloves = 170; if (curr < components.Length - 1) { characterProgress.setFavoredRace(int.Parse(components[curr++])); } }