private void UI_UpdateDisplayAugments() { for (uint i = 0; i < (uint)EAugmentSlot.MAX; ++i) { EAugmentSlot augSlot = (EAugmentSlot)i; if (m_player.m_playerAugmentHandler.HasAugment(augSlot)) { m_augmentsDisplay[i].sprite = m_player.m_playerAugmentHandler.GetAugment(augSlot).GetItemSprite(); m_augmentsDisplay_Cooldown[i].fillAmount = (m_player.m_playerAugmentHandler.GetAugment(augSlot).GetCooldownRatio()); if (m_player.m_playerAugmentHandler.GetAugment(augSlot).GetCooldown() == 0) { m_augmentsDisplay_Frame[i].color = Color.green; } else { m_augmentsDisplay_Frame[i].color = Color.red; } } else { m_augmentsDisplay[i].sprite = m_EmptyAugmentSprite; m_augmentsDisplay_Frame[i].color = Color.white; m_augmentsDisplay_Cooldown[i].fillAmount = 0; } } }
private void HandleItemDragging(UI_DragableItem dragableItem) { if (dragableItem) { if (dragableItem.IsDragging()) { //Move the element! Rect canvasSize = UI_CanvasManager.GetCanvas().pixelRect; dragableItem.GetParentTransform().SetParent(UI_CanvasManager.GetCanvas().transform); dragableItem.GetParentTransform().localPosition = UI_CanvasManager.ConvertScreenPositionToCanvasLocalPosition(UI_CanvasManager.GetMousePositionFromScreenCentre()); if (dragableItem.GetParentItem().GetItemType() == EItemType.WEAPON) { //Hovering over HAND SLOTS for (uint i = 0; i < (uint)EPlayerHand.MAX; i++) { //if your hovering over a UI hand if (UI_CanvasManager.IsPointInsideRect(m_loadout_hands[i].rectTransform, dragableItem.GetParentTransform().localPosition)) { m_loadout_handFrames[i].color = Color.green; } } } else { for (uint i = 0; i < (uint)EPlayerHand.MAX; i++) { m_loadout_handFrames[i].color = Color.red; } } if (dragableItem.GetParentItem().GetItemType() == EItemType.AUGMENT) { Augment aug = dragableItem.GetParentItem() as Augment; //Hovering over AUGMENTS for (int i = 0; i < (int)EAugmentSlot.MAX; ++i) { EAugmentSlot augSlot = (EAugmentSlot)i; if (UI_CanvasManager.IsPointInsideRect(m_augmentSlots[i].rectTransform, dragableItem.GetParentTransform().localPosition)) { if (m_player.m_playerAugmentHandler.CanAttachAugmentToSlot(augSlot, aug)) { m_augmentSlots_Frame[i].color = Color.green; } else { m_augmentSlots_Frame[i].color = Color.red; } } } } else { //display bad colours for aug slots for (int i = 0; i < (int)EAugmentSlot.MAX; ++i) { m_augmentSlots_Frame[i].color = Color.red; } } } } }