full turns
This commit is contained in:
parent
7bd61df481
commit
6ff1531662
15 changed files with 879 additions and 100 deletions
|
|
@ -20,46 +20,85 @@ public class ActionUIHandler : MonoBehaviour
|
|||
#endregion
|
||||
private PlayerEntity selectedEntity;
|
||||
private RangedWeapon possibleRanged;
|
||||
public bool opened;
|
||||
[Header("UI")]
|
||||
[SerializeField] private Vector3 offset;
|
||||
[SerializeField] private GameObject actionUI;
|
||||
[SerializeField] private Button moveButton;
|
||||
[SerializeField] private Button attackButton;
|
||||
[SerializeField] private Button reloadButton;
|
||||
|
||||
//500 if statements in this script lol
|
||||
public void ShowUI(PlayerEntity target)
|
||||
{
|
||||
opened = true;
|
||||
possibleRanged = null;
|
||||
selectedEntity = target;
|
||||
transform.position = Input.mousePosition + offset;
|
||||
if (target.currentWeapon.TryGetComponent(out RangedWeapon isRanged))
|
||||
actionUI.SetActive(true);
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
public void UpdateUI()
|
||||
{
|
||||
if (!selectedEntity.hasAttacked)
|
||||
{
|
||||
possibleRanged = isRanged;
|
||||
reloadButton.gameObject.SetActive(true);
|
||||
if (selectedEntity.currentWeapon.TryGetComponent(out RangedWeapon isRanged))
|
||||
{
|
||||
possibleRanged = isRanged;
|
||||
}
|
||||
if (!isRanged || !isRanged.fired)
|
||||
{
|
||||
reloadButton.gameObject.SetActive(false);
|
||||
attackButton.gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
reloadButton.gameObject.SetActive(true);
|
||||
attackButton.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
reloadButton.gameObject.SetActive(false);
|
||||
attackButton.gameObject.SetActive(false);
|
||||
}
|
||||
if (!selectedEntity.hasMoved || !selectedEntity.hasAttacked)
|
||||
{
|
||||
moveButton.gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
moveButton.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
if (selectedEntity.hasAttacked && selectedEntity.hasMoved)
|
||||
{
|
||||
HideUI();
|
||||
}
|
||||
actionUI.SetActive(true);
|
||||
}
|
||||
public void HideUI()
|
||||
{
|
||||
opened = false;
|
||||
actionUI.SetActive(false);
|
||||
}
|
||||
|
||||
public void ReloadGun()
|
||||
{
|
||||
possibleRanged.Reload();
|
||||
selectedEntity.hasAttacked = true;
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
public void Attack()
|
||||
{
|
||||
selectedEntity.Attack();
|
||||
HideUI();
|
||||
}
|
||||
|
||||
public void SkipTurn()
|
||||
{
|
||||
selectedEntity.SkipTurn();
|
||||
HideUI();
|
||||
}
|
||||
public void MoveEntity()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue