void Update() { // IF there isn't a player active on the scene. if (playerManager == null) { // Get the Player GameObject. playerManager = Character_Manager.GetPlayerManager(); return; } // IF the equipment component isn't set yet if (equipment == null) { // Get the Equipment script that is on the player GameObject. equipment = playerManager.GetComponentInChildren <Equipment> (); return; } // Create a variable to hold the item. Item equip = null; // IF we have a weapon image we want to update, // ELSE IF we have a armour image we want to update, // ELSE IF we have a bracelet image we want to update, // ELSE IF we have a ring image we want to update. if (itemSlot == "Weapon") { // Get the weapon from the Equipment script. equip = equipment.GetWeapon(); } else if (itemSlot == "Armour") { // Get the armour from the Equipment script. equip = equipment.GetArmour(); } else if (itemSlot == "Bracelet") { // Get the bracelet from the Equipment script. equip = equipment.GetBracelet(); } else if (itemSlot == "Ring") { // Get the ring from the Equipment script. equip = equipment.GetRing(); } // IF there is an item, // ELSE there is not a item. if (equip != null) { // Grab the weapon. equipmentImage.sprite = equip.SpriteImage; // Set the color. equipmentImage.color = new Color(equip.R, equip.G, equip.B, equip.A); } else { // Set the color. equipmentImage.color = new Color(0f, 0f, 0f, 0f); } }
/// <summary> /// Showing our tooltip. /// </summary> public void OnPointerEnter(PointerEventData data) { //// DEALING WITH A PRESET BAR //// // IF we are dealing with a weapon, // ELSE IF we are dealing with armour, // ELSE IF if you want to add more. if (weaponOnly) { // Get the equipment that is on our player. Equipment charEquipment = Character_Helper.GetPlayerManager().GetComponentInChildren <Character_Manager> ().characterEquipment; // IF we don't have a weapon. if (charEquipment.GetWeapon() == null) { // We leave. return; } // Since we have a weapon we can now display our tooltip. Grid_Helper.tooltip.ActivateItemTooltip(charEquipment.GetWeapon(), transform.parent.gameObject); // We leave. return; } else if (armourOnly) { // Get the equipment that is on our player. Equipment charEquipment = Character_Helper.GetPlayerManager().GetComponentInChildren <Character_Manager> ().characterEquipment; // IF we don't have armour. if (charEquipment.GetArmour() == null) { // We leave. return; } // Since we have armour we can now display our tooltip. Grid_Helper.tooltip.ActivateItemTooltip(charEquipment.GetArmour(), transform.parent.gameObject); // We leave. return; } else if (helmetOnly) { // Get the equipment that is on our player. Equipment charEquipment = Character_Helper.GetPlayerManager().GetComponentInChildren <Character_Manager> ().characterEquipment; // IF we don't have helmet. if (charEquipment.GetHelmet() == null) { // We leave. return; } // Since we have a helmet we can now display our tooltip. Grid_Helper.tooltip.ActivateItemTooltip(charEquipment.GetHelmet(), transform.parent.gameObject); // We leave. return; } //// END OF DEALING WITH A PRESET BAR //// // IF we have a tooltip. if (Grid_Helper.tooltip != null) { // IF there is an item in this action bar, // ELSE IF there is a skill in this action bar. if (itemBar != null) { // Show the tooltip. Grid_Helper.tooltip.ActivateItemTooltip(itemBar, transform.parent.gameObject); } } }