//use this to give a gameobject's renderer that this object is spawned on to the correct properties public void ActivateItem(EquipmentScript eq, GameObject g) { //if the equipment has a type to be added, add it on the sprite if (eq.spriteEffect != EquipmentSpriteEffect.None) { g.AddComponent(Type.GetType(eq.spriteEffect.ToString())); Component comp = g.GetComponent(Type.GetType(eq.spriteEffect.ToString())); //checks the variable values for this equipment, and then make the values for the added component equal to the values foreach (FieldInfo fi in comp.GetType().GetFields()) { object obj = (System.Object)comp; if (fi.Name == "_ColorX") { fi.SetValue(obj, _ColorX); } if (fi.Name == "Distortion") { fi.SetValue(obj, Distortion); } if (fi.Name == "Speed") { fi.SetValue(obj, Speed); } } } }
//use this to summon an item and add it to your inventory public void SummonItem() { var items = GameManager.Instance.GetComponent <Items>().allEquipsDict; int rand = Random.Range(1, items.Count); Dictionary <int, string> equipIds = new Dictionary <int, string>(); int i = 1; //makes a dictionary of all of the equipment items and their id's foreach (KeyValuePair <string, EquipmentScript> equips in items) { equipIds.Add(equips.Value.id, equips.Key); i += 1; } if (equipIds.ContainsKey(rand)) { if (items.ContainsKey(equipIds[rand])) { EquipmentScript item = items[equipIds[rand]]; int itemCount = PlayerPrefs.GetInt(item.name); PlayerPrefs.SetInt(item.name, itemCount + 1); GameManager.Instance.GetComponent <YourItems>().GetYourItems(); } } }
//when an equipment slot is highlighted, a tooltip displays the info for the equipment in that slot void EquipOnSelect() { Vector3 location = new Vector3(equipToolTip.transform.position.x, currentSelectedEquip.transform.position.y, equipToolTip.transform.position.z); equipToolTip.transform.position = location; EquipmentScript tempEquip = gameManager.equipDict[currentSelectedEquip.transform.GetChild(0).GetComponent <Text>().text].GetComponent <EquipmentScript>(); equipToolTip.transform.GetChild(2).GetComponent <Text>().text = tempEquip.equipDescription; equipToolTip.SetActive(true); }
//Handler for when an equipment slot is chosen to equip something to. //displays the list of usable equipment in the party inventory void EquipHandle() { SoundManager.instance.MenuSelect(); //update data member that stores what was equipped in this slot when we entered this context //this is used to revert to that state if we back out of the equipment selection preEquip = gameManager.equipDict[currentSelectedEquip.transform.GetChild(0).GetComponent <Text>().text].GetComponent <EquipmentScript>(); //set state flags choosingSlot = false; choosingEquip = true; //hide equipment slots, show character sheet in order to display stats changing as different equipments are considered equipContainer.SetActive(false); infoContainer.SetActive(true); rightSheet.SetActive(true); equipmentListContainer.SetActive(true); equipmentScrollbar.SetActive(true); numButtons = 0f; int i = 1; //iterate through party inventory of equipment foreach (string equipName in gameManager.partyEquipList) { if (((currentSelectedEquip.transform.GetSiblingIndex() == 0) && (gameManager.equipDict[equipName].GetComponent <EquipmentScript>().slot == "W")) || ((currentSelectedEquip.transform.GetSiblingIndex() != 0) && (gameManager.equipDict[equipName].GetComponent <EquipmentScript>().slot == "A"))) { //only instantiate new buttons if no unused button exists if (i >= equipmentListContainer.transform.GetChild(0).childCount) { GameObject tempButton = Instantiate(equipmentButtonPrefab) as GameObject; tempButton.transform.SetParent(equipmentListContainer.transform.GetChild(0)); tempButton.transform.GetChild(0).GetComponent <Text>().text = equipName; tempButton.GetComponent <Button>().onClick.AddListener(TargetEquipHandle); tempButton.GetComponent <RectTransform>().localScale = new Vector3(1, 1, 1); } else { //otherwise change values in existing button, and reuse button GameObject tempButton = equipmentListContainer.transform.GetChild(0).GetChild(i).gameObject; tempButton.transform.GetChild(0).GetComponent <Text>().text = equipName; tempButton.SetActive(true); } i++; numButtons++; } } //initialize values for scrolling equipmentScrollbar.GetComponent <Scrollbar>().value = 1; currentSelectedTargetEquip = null; equipmentListContainer.transform.GetChild(0).GetChild(0).GetComponent <Button>().Select(); prevSelectedButton = equipmentListContainer.transform.GetChild(0).GetChild(0).gameObject; }
//remove the properties on the gameobject for this equipment public void DeactivateItem(EquipmentScript e, GameObject g) { //Debug.Log(e.itemName); //if the equipment has a type to be added, add it on the sprite if (e.spriteEffect != EquipmentSpriteEffect.None) { if (g.GetComponent(Type.GetType(e.spriteEffect.ToString(), true))) { Destroy(g.GetComponent(Type.GetType(e.spriteEffect.ToString()))); } } }
// Unequip modifies the unit's stats based on the equipment // (EquipmentScript) equipment is the equipment to be unequipped // (int) equipIndex is the equipment slot to be emptied public void Unequip(EquipmentScript equipment, int equipIndex) { // remove item from equipmentList equipmentList[equipIndex] = "Empty"; // modify all the stats maxHealth -= equipment.maxHealthMod; speed -= equipment.speedMod; range -= equipment.rangeMod; numAttacks -= equipment.numAttacksMod; attack -= equipment.attackMod; defense -= equipment.defenseMod; agility -= equipment.agilityMod; }
// Equip modifies the unit's stats based on the equipment // (EquipmentScript) equipment is the equipment to be equipped // (int) equipIndex is the equipment slot to be filled public void Equip(EquipmentScript equipment, int equipIndex) { // take equipment from party inventory, add to equipment list equipmentList[equipIndex] = equipment.equipName; // modify all the stats maxHealth += equipment.maxHealthMod; speed += equipment.speedMod; range += equipment.rangeMod; numAttacks += equipment.numAttacksMod; attack += equipment.attackMod; defense += equipment.defenseMod; agility += equipment.agilityMod; }
// Start is called before the first frame update void Start() { List <string> targetModes = new List <string>(); //the cap is 9 because there are currently 8 Target Modes, so this will fill them all for (int i = 0; i < 9; i++) { string mode = Enum.ToObject(typeof(TargetMode), i).ToString(); targetModes.Add(mode); } targetModeDropdown.AddOptions(targetModes); targetModeDropdown.value = 0; e1 = ScriptableObject.CreateInstance <EquipmentScript>(); e2 = ScriptableObject.CreateInstance <EquipmentScript>(); }
public Equipment(EquipmentScript e) { equipment = e; hpBonus = e.hpBonus; atkBonus = e.atkBonus; defBonus = e.defBonus; speedBonus = e.speedBonus; precBonus = e.precBonus; atkPowerBonus = e.atkPowerBonus; atkTimeBonus = e.atkTimeBonus; atkRangeBonus = e.atkRangeBonus; critModBonus = e.critModBonus; critChanceBonus = e.critChanceBonus; staminaBonus = e.staminaBonus; hpPercentBonus = e.hpPercentBonus; atkPercentBonus = e.atkPercentBonus; defPercentBonus = e.defPercentBonus; spePercentBonus = e.spePercentBonus; atkPowerPercentBonus = e.atkPowerPercentBonus; atkTimePercentBonus = e.atkTimePercentBonus; evasionPercentBonus = e.evasionPercentBonus; staminaPercentBonus = e.staminaPercentBonus; level = e.level; levelMax = e.equipLevelMax; itemName = e.itemName; expGiven = e.expGiven; alpha = e._Alpha; timeX = e._TimeX; colorX = e._ColorX; Speed = e.Speed; Distortion = e.Distortion; equipClass = e.equipClass; typeMonsterReq = e.typeMonsterReq; typeMoveReq = e.typeMoveReq; cost = e.cost; GetExpCurve(); }
public void Equip(EquipmentScript item) { int slotNum = (int)item.type; EquipmentScript itemToSwap = null; if (equipment [slotNum] != null) { itemToSwap = equipment [slotNum]; inventoryInstance.CanAddItem(itemToSwap); } if (onEquipmentChanged != null) { onEquipmentChanged.Invoke(item, itemToSwap); } equipment [slotNum] = item; }
public EquipEffect(Monster Monster, EquipmentScript Equipment, int slot) { monster = Monster; equipment = Equipment; Slot = slot; equipment.UnEquip(); //get string of the name of the item string name = string.Concat(equipment.itemName.Where(c => !char.IsWhiteSpace(c))); //convert string to a delegate to call the method of the name of the ability equipMethod = DelegateCreation(this, name); //call the method that lines up with the name of the item equipMethod.Invoke(); //refresh the monster's list of stat modifiers monster.MonsterStatMods(); }
public void OnEquipmentChanged(EquipmentScript ItemToAdd, EquipmentScript ItemToRemove) { if (ItemToAdd != null) { Defence.AddModifier(ItemToAdd.defenceModifier); Damage.AddModifier(ItemToAdd.damageModifier); Agility.AddModifier(ItemToAdd.agilityModifier); } if (ItemToRemove != null) { Defence.RemoveModifier(ItemToRemove.defenceModifier); Damage.RemoveModifier(ItemToRemove.damageModifier); Agility.RemoveModifier(ItemToRemove.agilityModifier); } }
//handler for the equipment menu button //when called, the equipment being used by the selected unit is display, and a slot may be selected to equip something to void SwapEquipHandle() { SoundManager.instance.MenuSelect(); //set state flags buttonContainerOpen = false; choosingSlot = true; currentSelectedEquip = null; //hide management options buttonContainer.SetActive(false); for (int i = 0; i < 4; i++) { EquipmentScript tempEquip = gameManager.equipDict[currentUnitScript.equipmentList[i]].GetComponent <EquipmentScript>(); equipContainer.transform.GetChild(i).GetChild(0).GetComponent <Text>().text = tempEquip.equipName; } //activate equipment slot buttons equipContainer.SetActive(true); //select first button equipContainer.transform.GetChild(0).GetComponent <Button>().Select(); prevSelectedButton = equipContainer.transform.GetChild(0).gameObject; }
//when this object is created, load a monster in to it and then display all of the information public void DisplayMonster(Monster m) { Monster = m; var data = GameManager.Instance.monstersData.monstersAllDict; var equips = GameManager.Instance.items.allEquipsDict; var statuses = GameManager.Instance.GetComponent <AllStatusEffects>().allStatusDict; var colors = GameManager.Instance.typeColorDictionary; Color type1Color = colors[m.info.type1]; Color atk1Color = colors[m.info.attack1.type]; Color atk2Color = colors[m.info.attack2.type]; GetComponent <SpriteRenderer>().color = type1Color; levelText.text = m.info.level.ToString(); attackText.text = Mathf.Round(m.info.Attack.Value).ToString(); koText.text = m.currentMapKOs.ToString(); nameText.text = m.info.name; monsterIcon.GetComponent <SpriteRenderer>().sprite = m.frontModel.GetComponent <SpriteRenderer>().sprite; //show the equipment if this monster has any if (equips.ContainsKey(m.info.equip1Name)) { EquipmentScript e = equips[m.info.equip1Name]; equip1.GetComponent <SpriteRenderer>().sprite = e.sprite; e.ActivateItem(e, equip1); } else { equip1.GetComponent <SpriteRenderer>().sprite = null; } if (equips.ContainsKey(m.info.equip2Name)) { EquipmentScript e = equips[m.info.equip2Name]; equip2.GetComponent <SpriteRenderer>().sprite = e.sprite; e.ActivateItem(e, equip2); } else { equip2.GetComponent <SpriteRenderer>().sprite = null; } //if there are no statuses, don't show anything in the status sprites if (m.statuses.Count == 0) { for (int s = 0; s < statusSprites.Length; s++) { statusSprites[s].sprite = null; } } else { for (int i = 0; i < m.statuses.Count; i++) { statusSprites[i].sprite = m.statuses[0].statusSprite; } } //show the rank this monster is with rank stars equal to its rank for (int r = 0; r < m.info.monsterRank; r++) { rankSprites[r].SetActive(true); } //set the attack graphics atk1Text.text = m.info.attack1Name; atk1Bg.GetComponent <SpriteRenderer>().color = atk1Color; atk2Bg.GetComponent <SpriteRenderer>().color = atk2Color; atk2Text.text = m.info.attack2Name; if (m.GetComponent <Tower>().attackNumber == 1) { atk1Outline.GetComponent <GoldFX>().enabled = true; atk2Outline.GetComponent <GoldFX>().enabled = false; } else { atk1Outline.GetComponent <GoldFX>().enabled = false; atk2Outline.GetComponent <GoldFX>().enabled = true; } //set the ability graphics abilityAmmoText.text = (m.info.specialAbility.castingAmmo - m.info.specialAbility.castingCount).ToString(); //lowerbound value for this fill is .23 while the upperbound is .86, thus these numbers staminaProgress.fillAmount = .23f + (.63f * m.GetComponent <Tower>().staminaBar.BarProgress); if (staminaProgress.fillAmount >= .86f) { stamFX._Color = Color.green; } else if (staminaProgress.fillAmount >= .73f) { stamFX._Color = Color.yellow; } else if (staminaProgress.fillAmount >= .63f) { stamFX._Color = Color.magenta; } else if (staminaProgress.fillAmount >= .49f) { stamFX._Color = Color.red; } else if (staminaProgress.fillAmount >= .39f) { stamFX._Color = Color.cyan; } else if (staminaProgress.fillAmount >= .28f) { stamFX._Color = Color.blue; } }
//When an equipment in the party equipment list is highlighted, the list scrolls, a tooltip is displayed, // and the units stats are updated to display what effect equipping that item would have void TargetEquipOnSelect() { /* * in order to scroll through the list with the arrow keys we have to check if the button selected is outside the * equipment window, and shift the buttons accordingly. */ RectTransform containerRect = equipmentListContainer.GetComponent <RectTransform>(); //get a reference point for where the top and bottom points of the equipment window are Vector3[] listOfCorners = new Vector3[4]; containerRect.GetWorldCorners(listOfCorners); float bottom = listOfCorners[0][1]; float top = listOfCorners[1][1]; //count the number of buttons outside the equipment windows current view float buttonsOutside = 0f; for (int i = 0; i < (int)numButtons + 1; i++) { float buttonY = equipmentListContainer.transform.GetChild(0).GetChild(i).position.y; if ((buttonY > top) || (buttonY < bottom)) { buttonsOutside++; } } if (buttonsOutside > 0) { //get reference points for where the top and bottom points of the selected button are Vector3[] buttonCorners = new Vector3[4]; currentSelectedTargetEquip.GetComponent <RectTransform>().GetWorldCorners(buttonCorners); float buttonBottom = buttonCorners[0][1]; float buttonTop = buttonCorners[1][1]; float buttonHeight = buttonTop - buttonBottom; //scroll the list just enough to get the selected button fully in view. if (buttonTop > top) { float diff = buttonTop - top; float ratio = diff / buttonHeight; equipmentScrollbar.GetComponent <Scrollbar>().value += ratio / buttonsOutside; } else if (buttonBottom < bottom) { float diff = bottom - buttonBottom; float ratio = diff / buttonHeight; equipmentScrollbar.GetComponent <Scrollbar>().value -= ratio / buttonsOutside; } } //the actually equipping of equipment takes place as soon as a piece of equipment is highlighted, in order to show the updated stats in the character sheet //if the player cancels out of this menu, the selected unit will re-equip whatever was equipped in that slot immediately. currentUnitScript.Unequip(gameManager.equipDict[currentUnitScript.equipmentList[currentSelectedEquip.transform.GetSiblingIndex()]].GetComponent <EquipmentScript>(), currentSelectedEquip.transform.GetSiblingIndex()); //turn off the tooltip if the unequip button is selected if (currentSelectedTargetEquip.transform.GetChild(0).GetComponent <Text>().text == "Unequip") { targetEquipToolTip.SetActive(false); } else { //otherwise update it's position and the information it displays EquipmentScript tempEquip = gameManager.equipDict[currentSelectedTargetEquip.transform.GetChild(0).GetComponent <Text>().text].GetComponent <EquipmentScript>(); targetEquipToolTip.transform.GetChild(2).GetComponent <Text>().text = tempEquip.equipDescription; Vector3 location = new Vector3(targetEquipToolTip.transform.position.x, currentSelectedTargetEquip.transform.position.y, targetEquipToolTip.transform.position.z); targetEquipToolTip.transform.position = location; targetEquipToolTip.SetActive(true); currentUnitScript.Equip(tempEquip, currentSelectedEquip.transform.GetSiblingIndex()); } //update character sheet, to reflect the stat changes introduced by the piece of equipment healthValueText.text = currentUnitScript.maxHealth.ToString(); agilityValueText.text = currentUnitScript.agility.ToString(); attackValueText.text = currentUnitScript.attack.ToString(); defenseValueText.text = currentUnitScript.defense.ToString(); speedValueText.text = currentUnitScript.speed.ToString(); rangeValueText.text = currentUnitScript.range.ToString(); }
//set the monster's stats from the values of the save token public void MonsterStatsSet() { var monsters = GameManager.Instance.monstersData.monstersAllDict; var attacks = GameManager.Instance.baseAttacks.attackDict; var abilities = GameManager.Instance.GetComponent <MonsterAbilities>().allAbilitiesDict; var skills = GameManager.Instance.GetComponent <AllSkills>().allSkillsDict; var allEquips = GameManager.Instance.items.allEquipsDict; var yourEquips = GameManager.Instance.Inventory.EquipmentPocket.items; info.type1 = monsters[info.species].type1; info.type2 = monsters[info.species].type2; info.maxLevel = monsters[info.species].maxLevel; info.levelConst = monsters[info.species].levelConst; info.energyCost = monsters[info.species].energyCost; info.energyGenBase = monsters[info.species].energyGenBase; info.type1 = monsters[info.species].type1; info.type2 = monsters[info.species].type2; info.dexId = monsters[info.species].id; info.hpBase = monsters[info.species].hpBase; info.atkBase = monsters[info.species].atkBase; info.defBase = monsters[info.species].defBase; info.speBase = monsters[info.species].speBase; info.precBase = monsters[info.species].precBase; info.staminaBase = monsters[info.species].staminaBase; info.Class = monsters[info.species].Class; info.coinGenBase = monsters[info.species].coinGenBase; info.attack1Name = saveToken.attack1; info.attack2Name = saveToken.attack2; info.index = saveToken.index; info.defenderIndex = saveToken.defenderIndex; info.level = saveToken.level; info.totalExp = saveToken.totalExp; info.monsterRank = saveToken.rank; info.koCount = saveToken.koCount; info.AttackPotential.BaseValue = saveToken.atkPot; info.DefensePotential.BaseValue = saveToken.defPot; info.SpeedPotential.BaseValue = saveToken.spePot; info.PrecisionPotential.BaseValue = saveToken.precPot; info.HPPotential.BaseValue = saveToken.hpPot; info.name = saveToken.name; info.equip1Name = saveToken.equip1; info.equip1Exp = saveToken.equip1Exp; info.equip2Name = saveToken.equip2; info.equip2Exp = saveToken.equip2Exp; info.maxLevel = saveToken.maxLevel; info.equip1Slot = saveToken.equip1Slot; info.equip2Slot = saveToken.equip2Slot; info.isStar = saveToken.isStar; if (allEquips.ContainsKey(info.equip1Name)) { //info.equipment1 = allEquips[info.equip1Name]; EquipmentScript eq = Instantiate(allEquips[info.equip1Name]); info.equip1 = new Equipment(eq); for (int i = 0; i < yourEquips.Count; i++) { if (yourEquips[i].slotIndex == info.equip1Slot) { //info.equip1.monster = this; info.equip1.SetInventorySlot(yourEquips[i]); info.equip1Exp = info.equip1.inventorySlot.itemExp; } } //EquipmentScript e = Instantiate(allEquips[info.equip1Name]); //info.equip1.Equip(this, 1); } else { //info.equipment1 = null; info.equip1 = null; info.equip1Exp = 0; } if (allEquips.ContainsKey(info.equip2Name)) { //info.equipment2 = allEquips[info.equip2Name]; EquipmentScript eq = Instantiate(allEquips[info.equip2Name]); info.equip2 = new Equipment(eq); //EquipmentScript e = Instantiate(allEquips[info.equip2Name]); //info.equip2.Equip(this, 2); for (int i = 0; i < yourEquips.Count; i++) { if (yourEquips[i].slotIndex == info.equip2Slot) { //info.equip2.monster = this; info.equip2.SetInventorySlot(yourEquips[i]); info.equip2Exp = info.equip2.inventorySlot.itemExp; } } //info.equip2.Equip(this, 2); } else { //info.equipment2 = null; info.equip2 = null; info.equip2Exp = 0; } info.abilityName = saveToken.specialAbility; info.specialAbility = new MonsterAbility(abilities[info.abilityName], this); info.skillName = saveToken.passiveSkill; info.passiveSkill = new PassiveSkill(this, skills[info.skillName]); //info.equippable1 = new EquippableItem(); //info.equippable2 = new EquippableItem(); //info.baseAttack1.attack = attacks[info.attack1Name]; //info.baseAttack2.attack = attacks[info.attack2Name]; if (attacks.ContainsKey(info.attack1Name)) { info.baseAttack1 = new BaseAttack(attacks[info.attack1Name], this); } else { info.baseAttack1 = null; } if (attacks.ContainsKey(info.attack2Name)) { info.baseAttack2 = new BaseAttack(attacks[info.attack2Name], this); } else { info.baseAttack2 = null; } if (info.isStar) { bodyParts.StarMonster(); } SetExp(); }
void _createEquipmentScript() { EquipmentScript es = character.GetComponent <EquipmentScript>(); if (!es) { es = Undo.AddComponent <EquipmentScript>(character); } Animator anim = character.GetComponent <Animator>(); if (!anim) { Debug.LogError("Cannot find 'Animator' component on " + character.name); return; } Transform rhand = anim.GetBoneTransform(HumanBodyBones.RightHand); Transform lHand = anim.GetBoneTransform(HumanBodyBones.LeftHand); Transform lHip = anim.GetBoneTransform(HumanBodyBones.LeftUpperLeg); Transform lElbow = anim.GetBoneTransform(HumanBodyBones.LeftLowerArm); Transform chest = anim.GetBoneTransform(HumanBodyBones.Chest); Transform rIndex = anim.GetBoneTransform(HumanBodyBones.RightIndexProximal); Transform rHip = anim.GetBoneTransform(HumanBodyBones.RightUpperLeg); GameObject WEAPON_WIELD = new GameObject("WEAPON_WIELD"); GameObject WEAPON1H_REST = new GameObject("WEAPON1H_REST"); GameObject SHIELD_WIELD = new GameObject("SHIELD_WIELD"); GameObject SHIELD_REST = new GameObject("SHIELD_REST"); GameObject WEAPON2H_REST = new GameObject("WEAPON2H_REST"); GameObject QUIVER_REST = new GameObject("QUIVER_REST"); GameObject BOW_REST = new GameObject("BOW_REST"); GameObject BOW_WIELD = new GameObject("BOW_WIELD"); GameObject ARROW = new GameObject("ARROW"); GameObject SECONDARY_REST = new GameObject("SECONDARY_REST"); GameObject SECONDARY_WIELD = new GameObject("SECONDARY_WIELD"); Undo.RegisterCreatedObjectUndo(WEAPON_WIELD, "Create Weapon1H Wield Bone"); Undo.RegisterCreatedObjectUndo(WEAPON1H_REST, "Create Weapon1H Rest Bone"); Undo.RegisterCreatedObjectUndo(SHIELD_WIELD, "Create Shield Wield Bone"); Undo.RegisterCreatedObjectUndo(SHIELD_REST, "Create Shield Rest Bone"); Undo.RegisterCreatedObjectUndo(WEAPON2H_REST, "Create Weapon2H Rest Bone"); Undo.RegisterCreatedObjectUndo(QUIVER_REST, "Create Quiver Rest Bone"); Undo.RegisterCreatedObjectUndo(BOW_REST, "Create BowRest Bone"); Undo.RegisterCreatedObjectUndo(BOW_WIELD, "Create Bow Wield Bone"); Undo.RegisterCreatedObjectUndo(ARROW, "Create Arrow Bone"); Undo.RegisterCreatedObjectUndo(SECONDARY_REST, "Create Socindary Weapon Rest Bone"); Undo.RegisterCreatedObjectUndo(SECONDARY_WIELD, "Create Secondary Weapon Wield Bone"); WEAPON_WIELD.transform.SetParent(rhand); WEAPON1H_REST.transform.SetParent(lHip); SHIELD_WIELD.transform.SetParent(lElbow); SHIELD_REST.transform.SetParent(chest); WEAPON2H_REST.transform.SetParent(chest); QUIVER_REST.transform.SetParent(chest); BOW_REST.transform.SetParent(chest); BOW_WIELD.transform.SetParent(lHand); ARROW.transform.SetParent(rIndex); SECONDARY_REST.transform.SetParent(rHip); SECONDARY_WIELD.transform.SetParent(lHand); if (es.bones == null) { es.bones = new EquipmentBones(); } es.bones.weapon1H_wield_bone = WEAPON_WIELD.transform; es.bones.weapon2H_wield_bone = WEAPON_WIELD.transform; es.bones.weapon1H_wield_bone.localPosition = Vector3.zero; es.bones.weapon1H_wield_bone.localRotation = Quaternion.identity; es.bones.weapon1H_rest_bone = WEAPON1H_REST.transform; es.bones.weapon1H_rest_bone.localPosition = Vector3.zero; es.bones.weapon1H_rest_bone.localRotation = Quaternion.identity; es.bones.shield_wield_bone = SHIELD_WIELD.transform; es.bones.shield_wield_bone.localPosition = Vector3.zero; es.bones.shield_wield_bone.localRotation = Quaternion.identity; es.bones.shield_rest_bone = SHIELD_REST.transform; es.bones.shield_rest_bone.localPosition = Vector3.zero; es.bones.shield_rest_bone.localRotation = Quaternion.identity; es.bones.weapon2H_rest_bone = WEAPON2H_REST.transform; es.bones.weapon2H_rest_bone.localPosition = Vector3.zero; es.bones.weapon2H_rest_bone.localRotation = Quaternion.identity; es.bones.quiver_rest_bone = QUIVER_REST.transform; es.bones.quiver_rest_bone.localPosition = Vector3.zero; es.bones.quiver_rest_bone.localRotation = Quaternion.identity; es.bones.bow_rest_bone = BOW_REST.transform; es.bones.bow_rest_bone.localPosition = Vector3.zero; es.bones.bow_rest_bone.localRotation = Quaternion.identity; es.bones.bow_wield_bone = BOW_WIELD.transform; es.bones.bow_wield_bone.localPosition = Vector3.zero; es.bones.bow_wield_bone.localRotation = Quaternion.identity; es.bones.arrow_bone = ARROW.transform; es.bones.arrow_bone.localPosition = Vector3.zero; es.bones.arrow_bone.localRotation = Quaternion.identity; es.bones.secondary1H_rest_bone = SECONDARY_REST.transform; es.bones.secondary1H_rest_bone.localPosition = Vector3.zero; es.bones.secondary1H_rest_bone.localRotation = Quaternion.identity; es.bones.secondary1H_wield_bone = SECONDARY_WIELD.transform; es.bones.secondary1H_wield_bone.localPosition = Vector3.zero; es.bones.secondary1H_wield_bone.localRotation = Quaternion.identity; }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { var equips = GameManager.Instance.items.allEquipsDict; Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); Vector2 mousePos2D = new Vector2(mousePos.x, mousePos.y); RaycastHit2D hit = Physics2D.Raycast(mousePos2D, Vector2.zero); //if this tower is clicked on, it can be placed if (hit.collider != null) { if (hit.collider.gameObject.tag == "Tower") { //GameManager.Instance.OverworldMenuControl(); //GameManager.Instance.overworldMenu.GetComponentInChildren<OverworldInfoMenu>().activeMonster = hit.collider.gameObject.GetComponent<Monster>(); infoMenu.SetActive(true); if (enemyInfoMenu) { enemyInfoMenu.SetActive(false); } activeMonster = hit.collider.gameObject.GetComponent <Monster>(); //checks the monster's equipment and displays the matching sprites if there is equipment on the monster if (equips.ContainsKey(activeMonster.info.equip1Name)) { e1.DeactivateItem(e1, equip1); e1 = equips[activeMonster.info.equip1Name]; //equip1.GetComponent<Image>().color = Color.white; equip1.name = activeMonster.info.equip1Name; equip1.GetComponent <SpriteRenderer>().sprite = equips[activeMonster.info.equip1Name].sprite; e1.ActivateItem(e1, equip1); } else { equip1.GetComponent <SpriteRenderer>().sprite = null; //equip1.GetComponent<Image>().color = Color.clear; equip1.name = "Equip1"; e1.DeactivateItem(e1, equip1); //e1 = null; } if (equips.ContainsKey(activeMonster.info.equip2Name)) { e2.DeactivateItem(e2, equip2); e2 = equips[activeMonster.info.equip2Name]; //equip2.GetComponent<Image>().color = Color.white; equip2.name = activeMonster.info.equip2Name; equip2.GetComponent <SpriteRenderer>().sprite = equips[activeMonster.info.equip2Name].sprite; e2.ActivateItem(e2, equip2); } else { equip2.GetComponent <SpriteRenderer>().sprite = null; equip2.name = "Equip2"; e2.DeactivateItem(e2, equip2); //e2 = null; //equip2.GetComponent<Image>().color = Color.clear; } } } } CheckMonster(); if (activeMonster) { type1.GetComponent <Image>(); type2.GetComponent <Image>(); var types = GameManager.Instance.monstersData.typeChartDict; var equips = GameManager.Instance.items.allEquipsDict; //monsterName.text = activeMonster.info.name; //attack1BtnText.text = activeMonster.info.attack1Name; //atk1Power.text = activeMonster.info.attack1.Power.Value.ToString(); //atk1Range.text = activeMonster.info.attack1.Range.Value.ToString(); //atk1TypeSp.sprite = types[activeMonster.info.attack1.type].typeSprite; //attack2BtnText.text = activeMonster.info.attack2Name; //atk2Power.text = activeMonster.info.attack2.Power.Value.ToString(); //atk2Range.text = activeMonster.info.attack2.Range.Value.ToString(); //atk2TypeSp.sprite = types[activeMonster.info.attack2.type].typeSprite; monsterName.text = activeMonster.info.name; attack1BtnText.text = activeMonster.info.attack1Name; atk1Power.text = activeMonster.info.baseAttack1.Power.Value.ToString(); atk1Range.text = activeMonster.info.baseAttack1.Range.Value.ToString(); atk1TypeSp.sprite = types[activeMonster.info.baseAttack1.type].typeSprite; attack2BtnText.text = activeMonster.info.attack2Name; atk2Power.text = activeMonster.info.baseAttack2.Power.Value.ToString(); atk2Range.text = activeMonster.info.baseAttack2.Range.Value.ToString(); atk2TypeSp.sprite = types[activeMonster.info.baseAttack2.type].typeSprite; //levelText.text = "Level: " + activeMonster.info.level.ToString(); //atkText.text = "Atk: " + Math.Round(activeMonster.attack, 0).ToString(); //defText.text = "Def: " + Math.Round(activeMonster.defense, 0).ToString(); //speText.text = "Speed: " + Math.Round(activeMonster.speed, 0).ToString(); //precText.text = "Prec: " + Math.Round(activeMonster.precision, 0).ToString(); //typeText.text = "Type: " + activeMonster.info.type1 + "/" + activeMonster.info.type2; //evasText.text = "Evasion: " + Math.Round(activeMonster.evasion, 0) + "%"; //enGenText.text = "En Gen: " + Math.Round((activeMonster.energyGeneration / 60), 2) + " /s"; //enCostText.text = "Cost: " + activeMonster.energyCost; levelText.text = "Level: " + activeMonster.info.level.ToString(); atkText.text = "Atk: " + Math.Round(activeMonster.info.Attack.Value, 0).ToString(); defText.text = "Def: " + Math.Round(activeMonster.info.Defense.Value, 0).ToString(); speText.text = "Speed: " + Math.Round(activeMonster.info.Speed.Value, 0).ToString(); precText.text = "Prec: " + Math.Round(activeMonster.info.Precision.Value, 0).ToString(); //typeText.text = "Type: " + activeMonster.info.type1 + "/" + activeMonster.info.type2; evasText.text = "Evasion: " + Math.Round(activeMonster.info.evasionBase, 0) + "%"; enGenText.text = "En Gen: " + Math.Round((activeMonster.info.EnergyGeneration.Value / 60), 2) + " /s"; enCostText.text = "Cost: " + activeMonster.info.EnergyCost.Value; staminaText.text = "Stamina: " + activeMonster.info.Stamina.Value; if (activeMonster.expToLevel.ContainsKey(activeMonster.info.level)) { int toNextLevel = activeMonster.expToLevel[activeMonster.info.level + 1]; int totalNextLevel = activeMonster.totalExpForLevel[activeMonster.info.level + 1]; int nextLevelDiff = totalNextLevel - activeMonster.info.totalExp; expSlider.maxValue = toNextLevel; expSlider.value = toNextLevel - nextLevelDiff; toLevelText.text = "EXP Until Level Up: " + nextLevelDiff.ToString(); } //checks the monster's type against the type sprites and changes their images to match the correct type sprite if (types.ContainsKey(activeMonster.info.type1)) { type1.GetComponent <Image>().sprite = types[activeMonster.info.type1].typeSprite; type1.GetComponent <Image>().color = Color.white; //type1.transform.localScale = new Vector3(3.5f, 1.25f, type1.transform.localScale.z); type1.name = activeMonster.info.type1; } else { type1.GetComponent <Image>().sprite = null; type1.name = "Type1"; } if (types.ContainsKey(activeMonster.info.type2)) { type2.GetComponent <Image>().sprite = types[activeMonster.info.type2].typeSprite; type2.GetComponent <Image>().color = Color.white; //type2.transform.localScale = new Vector3(3.5f, 1.25f, type2.transform.localScale.z); type2.name = activeMonster.info.type2; } else { type2.GetComponent <Image>().sprite = null; type2.GetComponent <Image>().color = Color.clear; type2.name = "Type2"; } targetModeDropdown.value = (int)Enum.ToObject(typeof(TargetMode), activeMonster.GetComponent <Tower>().targetMode); staminaBar.BarProgress = activeMonster.GetComponent <Tower>().staminaBar.BarProgress; if (activeMonster.GetComponent <Tower>().staminaBar.BarProgress >= 1 && (activeMonster.info.specialAbility.castingAmmo - activeMonster.info.specialAbility.castingCount) > 0) { activateAbilityBtn.interactable = true; activateAbilityBtn.gameObject.GetComponent <GoldFX>().enabled = true; } else { activateAbilityBtn.interactable = false; activateAbilityBtn.gameObject.GetComponent <GoldFX>().enabled = false; } //set the status of the find/place monster button if (activeMonster.GetComponent <Tower>().mapTileOn != null) { findMonsterBtn.interactable = true; findMonsterBtn.GetComponentInChildren <TMP_Text>().text = "Find Monster"; } else { findMonsterBtn.GetComponentInChildren <TMP_Text>().text = "Summon Monster"; if (tileToBePlaced != null) { findMonsterBtn.interactable = true; } else { findMonsterBtn.interactable = false; } } abiNameText.text = activeMonster.info.specialAbility.abilityName; abiDescriptionText.text = activeMonster.info.specialAbility.description; ammoText.text = "Ammo: " + (activeMonster.info.specialAbility.castingAmmo - activeMonster.info.specialAbility.castingCount).ToString(); //if (activeMonster.GetComponent<Tower>(). //indicator.transform.position = new Vector2(activeMonster.specs.head.transform.position.x, activeMonster.specs.head.transform.position.y + 40); } }
//this is called from the Monster script. information of this enemy is taken from the Monster Script, but new data is added since it's an "Enemy", so it will very likely be its own unique monster public void SetEnemyStats(int level) { var monsters = GameManager.Instance.monstersData.monstersAllDict; var attacks = GameManager.Instance.baseAttacks.attackDict; var abilities = GameManager.Instance.GetComponent <MonsterAbilities>().allAbilitiesDict; var skills = GameManager.Instance.GetComponent <AllSkills>().allSkillsDict; var allEquips = GameManager.Instance.items.allEquipsDict; monster.info.name = monster.info.species; monster.info.maxLevel = monsters[monster.info.species].maxLevel; monster.info.levelConst = monsters[monster.info.species].levelConst; monster.info.energyCost = monsters[monster.info.species].energyCost; monster.info.energyGenBase = monsters[monster.info.species].energyGenBase; monster.info.type1 = monsters[monster.info.species].type1; monster.info.type2 = monsters[monster.info.species].type2; monster.info.dexId = monsters[monster.info.species].id; monster.info.hpBase = monsters[monster.info.species].hpBase; monster.info.atkBase = monsters[monster.info.species].atkBase; monster.info.defBase = monsters[monster.info.species].defBase; monster.info.speBase = monsters[monster.info.species].speBase; monster.info.precBase = monsters[monster.info.species].precBase; monster.info.staminaBase = monsters[monster.info.species].staminaBase; monster.info.Class = monsters[monster.info.species].Class; monster.info.coinGenBase = monsters[monster.info.species].coinGenBase; monster.info.level = level; int starChance = monsters[monster.info.species].starChance; int randStar = Random.Range(0, 500); if (randStar <= starChance) { monster.info.isStar = true; monster.bodyParts.StarMonster(); } if (allEquips.ContainsKey(monster.info.equip1Name)) { EquipmentScript eq = Instantiate(allEquips[monster.info.equip1Name]); monster.info.equip1 = new Equipment(eq); } else { monster.info.equip1 = null; } if (allEquips.ContainsKey(monster.info.equip2Name)) { EquipmentScript eq = Instantiate(allEquips[monster.info.equip2Name]); monster.info.equip2 = new Equipment(eq); } else { monster.info.equip2 = null; } //set the monster's ability' if (monsters[monster.info.species].abilities.Length > 1) { int ab = Random.Range(0, monsters[monster.info.species].abilities.Length - 1); monster.info.abilityName = monsters[monster.info.species].abilities[ab]; } else { monster.info.abilityName = monsters[monster.info.species].abilities[0]; } //set the monster's skill if (monsters[monster.info.species].skills.Length > 1) { int sk = Random.Range(0, monsters[monster.info.species].skills.Length - 1); monster.info.skillName = monsters[monster.info.species].skills[sk]; } else { monster.info.skillName = monsters[monster.info.species].skills[0]; } //set the monster's first 2 base attacks int rand = Random.Range(0, monsters[monster.info.species].baseAttacks.Length - 1); monster.info.attack1Name = monsters[monster.info.species].baseAttacks[rand]; int rand2 = Random.Range(0, monsters[monster.info.species].baseAttacks.Length - 1); monster.info.attack2Name = monsters[monster.info.species].baseAttacks[rand2]; monster.info.specialAbility = new MonsterAbility(abilities[monster.info.abilityName], monster); monster.info.passiveSkill = new PassiveSkill(monster, skills[monster.info.skillName]); StartCoroutine(monster.WeatherCheck()); int hpRand = Random.Range(0, 26); int defRand = Random.Range(0, 26); int speRand = Random.Range(0, 26); StatsCalc StatsCalc = new StatsCalc(monster); GetEnemyStats(StatsCalc); monster.info.currentHP = monster.info.maxHP; enemyHpSlider.maxValue = monster.info.maxHP; enemyHpSlider.value = monster.info.currentHP; speed = 40 * ((float)monster.info.speBase / 100); }
//refresh the stat boxes of the monster when something about the monster changes public void RefreshMonsterInfo(Monster thisMonster) { GameObject[] equips = GameObject.FindGameObjectsWithTag("Respawn"); for (int e = 0; e < equips.Length; e++) { Destroy(equips[e]); } if (e1) { e1.DeactivateItem(e1, equip1Btn.gameObject); } if (e2) { e2.DeactivateItem(e2, equip2Btn.gameObject); } var allEquipment = GameManager.Instance.GetComponent <Items>().allEquipsDict; var abilities = GameManager.Instance.GetComponent <MonsterAbilities>().allAbilitiesDict; GetComponentInChildren <EnviromentCanvas>().GetEnviroment(thisMonster.info.type1); //show the equipment item for Slot 1 //if (equipment.ContainsKey(thisMonster.info.equip1Name)) if (allEquipment.ContainsKey(monster.info.equip1Name)) { equip1Btn.GetComponent <Image>().color = Color.white; //equips1 = monster.info.equip1; equips1 = new Equipment(allEquipment[monster.info.equip1Name]); e1 = equips1.equipment; equips1.SetInventorySlot(monster.info.equip1.inventorySlot); equips1.GetStats(); equips1.Equip(monster, 1); equip1Btn.interactable = false; equip1Btn.GetComponent <Image>().sprite = equips1.equipment.sprite; equip1Btn.name = allEquipment[monster.info.equip1Name].name; isEquip1 = true; equips1.equipment.ActivateItem(equips1.equipment, equip1Btn.gameObject); } else { equip1Btn.GetComponent <Image>().sprite = null; equip1Btn.GetComponent <Image>().color = Color.clear; equip1Btn.interactable = true; isEquip1 = false; equips1 = null; e1 = null; } //show the equipped item in slot 2 if (allEquipment.ContainsKey(monster.info.equip2Name)) { equip2Btn.GetComponent <Image>().color = Color.white; equips2 = new Equipment(allEquipment[monster.info.equip2Name]); e2 = equips2.equipment; equips2.SetInventorySlot(monster.info.equip2.inventorySlot); equips2.GetStats(); equips2.Equip(monster, 2); equip2Btn.interactable = false; equip2Btn.GetComponent <Image>().sprite = equips2.equipment.sprite; equip2Btn.name = allEquipment[monster.info.equip2Name].name; isEquip2 = true; equips2.equipment.ActivateItem(equips2.equipment, equip2Btn.gameObject); } else { equip2Btn.GetComponent <Image>().sprite = null; equip2Btn.GetComponent <Image>().color = Color.clear; equip2Btn.interactable = true; isEquip2 = false; equips2 = null; e2 = null; } thisMonster = monster; monsterNameText.text = thisMonster.info.name; //typeText.text = thisMonster.info.type1 + "/" + thisMonster.info.type2; levelText.text = thisMonster.info.level.ToString(); atkText.text = Math.Round(thisMonster.info.Attack.Value, 0).ToString(); defText.text = Math.Round(thisMonster.info.Defense.Value, 0).ToString(); speText.text = Math.Round(thisMonster.info.Speed.Value, 0).ToString(); precText.text = Math.Round(thisMonster.info.Precision.Value, 0).ToString(); evasionText.text = thisMonster.info.evasionBase + "%"; //energyGenText.text = Math.Round(thisMonster.energyGeneration / 60, 2) + " /s"; energyGenText.text = Math.Round(thisMonster.info.EnergyGeneration.Value / 60, 2) + " /s"; energyCostText.text = thisMonster.info.EnergyCost.Value.ToString(); stamTxt.text = Math.Round(thisMonster.info.Stamina.Value, 0).ToString(); abilityNameText.text = thisMonster.info.abilityName; abilityText.text = abilities[thisMonster.info.abilityName].description; coinGenText.text = thisMonster.info.CoinGeneration.Value + " /h"; koCountText.text = thisMonster.info.koCount.ToString(); atkBoostText.text = "(+ " + Math.Round((thisMonster.info.Attack.Value - thisMonster.info.Attack.BaseValue), 0) + ")".ToString(); defBoostText.text = "(+ " + Math.Round((thisMonster.info.Defense.Value - thisMonster.info.Defense.BaseValue), 0) + ")".ToString(); speBoostText.text = "(+ " + Math.Round((thisMonster.info.Speed.Value - thisMonster.info.Speed.BaseValue), 0) + ")".ToString(); precBoostText.text = "(+ " + Math.Round((thisMonster.info.Precision.Value - thisMonster.info.Precision.BaseValue), 0) + ")".ToString(); evasBoostText.text = "(+ " + Math.Round((thisMonster.info.evasionBase - thisMonster.info.evasionBase), 0) + ")".ToString(); enGenBoostText.text = "(+ " + Math.Round((thisMonster.info.EnergyGeneration.BaseValue - thisMonster.info.EnergyGeneration.Value), 2) + ")".ToString(); costBoostText.text = "(+ " + Math.Round((thisMonster.info.EnergyCost.Value - thisMonster.info.EnergyCost.BaseValue), 0) + ")".ToString(); stamBoostText.text = "(+ " + Math.Round((thisMonster.info.Stamina.Value - thisMonster.info.Stamina.BaseValue), 0) + ")".ToString(); enGenBoostText.text = "(+ 0)"; coinGenBoost.text = "(+ 0)"; if (thisMonster.info.Attack.BaseValue != thisMonster.info.Attack.Value) { atkText.color = Color.yellow; } else { atkText.color = Color.white; } if (thisMonster.info.Defense.BaseValue != thisMonster.info.Defense.Value) { defText.color = Color.yellow; } else { defText.color = Color.white; } if (thisMonster.info.Speed.BaseValue != thisMonster.info.Speed.Value) { speText.color = Color.yellow; } else { speText.color = Color.white; } if (thisMonster.info.Precision.BaseValue != thisMonster.info.Precision.Value) { precText.color = Color.yellow; } else { precText.color = Color.white; } if (Math.Round(thisMonster.info.EnergyGeneration.BaseValue, 0) != Math.Round(thisMonster.info.EnergyGeneration.Value, 0)) { energyGenText.color = Color.yellow; } else { energyGenText.color = Color.white; } if (Math.Round(thisMonster.info.EnergyCost.BaseValue, 0) != Math.Round(thisMonster.info.EnergyCost.Value, 0)) { energyCostText.color = Color.yellow; } else { energyCostText.color = Color.white; } if (Math.Round(thisMonster.info.Stamina.BaseValue, 0) != Math.Round(thisMonster.info.Stamina.Value, 0)) { stamTxt.color = Color.yellow; } else { stamTxt.color = Color.white; } if (Math.Round(thisMonster.info.CoinGeneration.BaseValue, 0) != Math.Round(thisMonster.info.CoinGeneration.Value, 0)) { coinGenText.color = Color.yellow; } else { coinGenText.color = Color.white; } evasionText.color = Color.white; attack1.text = thisMonster.info.attack1Name; atk1Attack.text = thisMonster.info.baseAttack1.Power.Value.ToString(); atk1Range.text = thisMonster.info.baseAttack1.Range.Value.ToString(); atk1Cool.text = thisMonster.info.baseAttack1.AttackTime.Value.ToString(); atk1Slow.text = thisMonster.info.baseAttack1.AttackSlow.Value.ToString(); atk1Mode.sprite = GameManager.Instance.baseAttacks.atkModeDict[thisMonster.info.baseAttack1.attack.attackMode.ToString()]; atk1Mode.name = thisMonster.info.baseAttack1.attack.attackMode.ToString(); atk1Stamina.text = thisMonster.info.baseAttack1.StaminaGained.Value.ToString(); attack1Border.GetComponent <SpriteRenderer>().color = GameManager.Instance.typeColorDictionary[thisMonster.info.baseAttack1.type]; ColorBlock cb = new ColorBlock(); cb.normalColor = GameManager.Instance.typeColorDictionary[thisMonster.info.baseAttack1.type]; cb.highlightedColor = GameManager.Instance.typeColorDictionary[thisMonster.info.baseAttack1.type]; cb.pressedColor = new Color(.78f, .78f, .78f, 1f); cb.disabledColor = new Color(.78f, .78f, .78f, .5f); cb.colorMultiplier = 1f; attack1Btn.colors = cb; if (thisMonster.info.baseAttack1.effectName != "none") { atk1Effect.text = "+ " + thisMonster.info.baseAttack1.EffectChance.Value * 100 + "%"; atk1Status.color = Color.white; atk1Status.sprite = GameManager.Instance.GetComponent <AllStatusEffects>().allStatusDict[thisMonster.info.baseAttack1.effectName].statusSprite; atk1Status.name = thisMonster.info.baseAttack1.effectName; } else { atk1Effect.text = ""; atk1Status.sprite = null; atk1Status.color = Color.clear; atk1Status.name = "none"; } if (thisMonster.info.baseAttack1.Power.BaseValue != thisMonster.info.baseAttack1.Power.Value) { atk1Attack.color = Color.yellow; } else { atk1Attack.color = Color.white; } if (thisMonster.info.baseAttack1.Range.BaseValue != thisMonster.info.baseAttack1.Range.Value) { atk1Range.color = Color.yellow; } else { atk1Range.color = Color.white; } //if (thisMonster.tempStats.attack1.AttackTime.BaseValue != thisMonster.tempStats.attack1.AttackTime.Value) //{ // atk1Cool.color = Color.yellow; //} //else //{ // atk1Cool.color = Color.white; //} Color color2 = GameManager.Instance.typeColorDictionary[thisMonster.info.baseAttack2.type]; attack2.text = thisMonster.info.attack2Name; atk2Attack.text = thisMonster.info.baseAttack2.Power.Value.ToString(); atk2Range.text = thisMonster.info.baseAttack2.Range.Value.ToString(); atk2Cool.text = thisMonster.info.baseAttack2.AttackTime.Value.ToString(); atk2Slow.text = thisMonster.info.baseAttack2.AttackSlow.Value.ToString(); atk2Stamina.text = thisMonster.info.baseAttack2.attack.staminaGained.ToString(); attack2Border.GetComponent <SpriteRenderer>().color = color2; //attack2Panel.GetComponent<SpriteRenderer>().color = GameManager.Instance.typeColorDictionary[thisMonster.info.baseAttack2.type]; ColorBlock cb2 = new ColorBlock(); cb2.normalColor = color2; cb2.highlightedColor = color2; cb2.pressedColor = new Color(.78f, .78f, .78f, 1f); cb2.disabledColor = new Color(.78f, .78f, .78f, .5f); cb2.colorMultiplier = 1f; attack2Btn.colors = cb2; if (thisMonster.info.baseAttack2.effectName != "none") { atk2Effect.text = "+ " + thisMonster.info.baseAttack2.EffectChance.Value * 100 + "%"; atk2Status.color = Color.white; atk2Status.sprite = GameManager.Instance.GetComponent <AllStatusEffects>().allStatusDict[thisMonster.info.baseAttack2.effectName].statusSprite; atk2Status.name = thisMonster.info.baseAttack2.effectName; } else { atk2Effect.text = ""; atk2Status.sprite = null; atk2Status.color = Color.clear; atk2Status.name = "none"; } atk2Mode.sprite = GameManager.Instance.baseAttacks.atkModeDict[thisMonster.info.baseAttack2.attack.attackMode.ToString()]; atk2Mode.name = thisMonster.info.baseAttack2.attack.attackMode.ToString(); if (thisMonster.info.baseAttack2.Power.BaseValue != thisMonster.info.baseAttack2.Power.Value) { atk2Attack.color = Color.yellow; } else { atk2Attack.color = Color.white; } if (thisMonster.info.baseAttack2.Range.BaseValue != thisMonster.info.baseAttack2.Range.Value) { atk2Range.color = Color.yellow; } else { atk2Range.color = Color.white; } //if (thisMonster.tempStats.baseAttack2.AttackTime.BaseValue != thisMonster.tempStats.baseAttack2.AttackTime.Value) //{ // atk2Cool.color = Color.yellow; //} //else //{ // atk2Cool.color = Color.white; //} if (GetComponentInParent <YourHome>().activeMonster.expToLevel.ContainsKey(thisMonster.info.level)) { int toNextLevel = GetComponentInParent <YourHome>().activeMonster.expToLevel[thisMonster.info.level + 1]; int totalNextLevel = GetComponentInParent <YourHome>().activeMonster.totalExpForLevel[thisMonster.info.level + 1]; int nextLevelDiff = totalNextLevel - thisMonster.info.totalExp; expSlider.maxValue = toNextLevel; expSlider.value = toNextLevel - nextLevelDiff; toNextLevelText.text = "EXP Until Level Up: " + nextLevelDiff.ToString(); } //show the correct number of rank stars for (int i = 0; i < rankSprites.Length; i++) { if (thisMonster.saveToken.rank > i) { rankSprites[i].gameObject.SetActive(true); } else { rankSprites[i].gameObject.SetActive(false); } } skillName.text = thisMonster.info.skillName; skillDescription.text = thisMonster.info.passiveSkill.skill.description; if (thisMonster.info.isStar) { thisMonster.bodyParts.StarMonster(); } }