79 lines
2.5 KiB
C#
79 lines
2.5 KiB
C#
using Continentis.MainGame.Card;
|
|
using Continentis.MainGame.Character;
|
|
using Continentis.MainGame.UI;
|
|
using Sirenix.OdinInspector;
|
|
using SoulliesFramework.General;
|
|
using UnityEngine;
|
|
using UnityEngine.InputSystem;
|
|
using UnityEngine.Serialization;
|
|
|
|
namespace Continentis.MainGame
|
|
{
|
|
public partial class CombatUIManager : UIManagerBase
|
|
{
|
|
public new static CombatUIManager Instance => instance as CombatUIManager;
|
|
|
|
public Camera combatCamera;
|
|
public Camera uiCamera;
|
|
public DeckPage deckPage;
|
|
public HUDPage hudPage;
|
|
public ArrowsPage arrowsPage;
|
|
}
|
|
|
|
public partial class CombatUIManager
|
|
{
|
|
public CardViewBase hoveringCardView;
|
|
public CardViewBase selectingCardView;
|
|
public CombatCharacterViewBase hoveringCharacterView;
|
|
public CombatCharacterViewBase selectingCharacterView;
|
|
}
|
|
|
|
public partial class CombatUIManager
|
|
{
|
|
private void Update()
|
|
{
|
|
ManageCharacterViews();
|
|
}
|
|
}
|
|
|
|
public partial class CombatUIManager
|
|
{
|
|
private void ManageCharacterViews()
|
|
{
|
|
Ray ray = combatCamera.ScreenPointToRay(Mouse.current.position.ReadValue());
|
|
|
|
if (Physics.Raycast(ray, out RaycastHit hit, 2048, LayerMask.GetMask("Combat")))
|
|
{
|
|
if (hit.collider.gameObject.CompareTag("Character"))
|
|
{
|
|
hoveringCharacterView ??= hit.collider.GetComponent<CombatCharacterViewBase>();
|
|
|
|
if (Mouse.current.leftButton.wasPressedThisFrame)
|
|
{
|
|
selectingCharacterView?.hudContainer.DisableHUD("SelectingDot");
|
|
selectingCharacterView = hoveringCharacterView;
|
|
selectingCharacterView.hudContainer.EnableHUD("SelectingDot");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (Mouse.current.leftButton.wasPressedThisFrame)
|
|
{
|
|
selectingCharacterView?.hudContainer.DisableHUD("SelectingDot");
|
|
selectingCharacterView = null;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
hoveringCharacterView = null;
|
|
|
|
if (Mouse.current.leftButton.wasPressedThisFrame)
|
|
{
|
|
selectingCharacterView?.hudContainer.DisableHUD("SelectingDot");
|
|
selectingCharacterView = null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |