99 lines
3.3 KiB
C#
99 lines
3.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class TargetUIController : MonoBehaviour
|
|
{
|
|
// Controller to control the UI of the target,
|
|
// select target type, select prefeb to set or sth.
|
|
public GameObject TargetControllerObj;
|
|
public GameObject MouseSelectorObj;
|
|
public GameObject EnvironmentUIObj;
|
|
|
|
public Button setAttackButton;
|
|
public Button setGotoButton;
|
|
public Button setFreeButton;
|
|
public Button setStayButton;
|
|
|
|
private MouseInMap mouseInMapCon;
|
|
private EnvironmentUIControl envUICon;
|
|
private TargetController targetCon;
|
|
|
|
private void Start()
|
|
{
|
|
targetCon = TargetControllerObj.GetComponent<TargetController>();
|
|
mouseInMapCon = MouseSelectorObj.GetComponent<MouseInMap>();
|
|
envUICon = EnvironmentUIObj.GetComponent<EnvironmentUIControl>();
|
|
}
|
|
|
|
public void clearGamePressed()
|
|
{
|
|
// Clear all enemies and targets. set gamemode to Stay mode
|
|
targetCon.stayModeChange();
|
|
mouseInMapCon.changeMouseModeTo(MouseInMap.MouseMode.Default);
|
|
// disable setStayButton and enable other buttons
|
|
setStayButton.interactable = false;
|
|
setAttackButton.interactable = true;
|
|
setGotoButton.interactable = true;
|
|
setFreeButton.interactable = true;
|
|
targetCon.playInitialize();
|
|
}
|
|
public void setEnemyPressed()
|
|
{
|
|
mouseInMapCon.changeMouseModeTo(MouseInMap.MouseMode.EnemySet);
|
|
}
|
|
public void setGotoPressed()
|
|
{
|
|
mouseInMapCon.changeMouseModeTo(MouseInMap.MouseMode.GotoSet);
|
|
}
|
|
public void setAttackPressed()
|
|
{
|
|
mouseInMapCon.changeMouseModeTo(MouseInMap.MouseMode.AttackSet);
|
|
}
|
|
public void setFreePressed()
|
|
{
|
|
mouseInMapCon.changeMouseModeTo(MouseInMap.MouseMode.Default);
|
|
targetCon.freeModeChange();
|
|
setStayButton.interactable = true;
|
|
setAttackButton.interactable = true;
|
|
setGotoButton.interactable = true;
|
|
setFreeButton.interactable = false;
|
|
}
|
|
public void setStayPressed()
|
|
{
|
|
mouseInMapCon.changeMouseModeTo(MouseInMap.MouseMode.Default);
|
|
targetCon.stayModeChange();
|
|
setStayButton.interactable = false;
|
|
setAttackButton.interactable = true;
|
|
setGotoButton.interactable = true;
|
|
setFreeButton.interactable = true;
|
|
}
|
|
|
|
public void UIButtonInteractable(PlayGameModeController.GameMode nowMode = PlayGameModeController.GameMode.Stay)
|
|
{
|
|
setStayButton.interactable = true;
|
|
setAttackButton.interactable = true;
|
|
setGotoButton.interactable = true;
|
|
setFreeButton.interactable = true;
|
|
switch(nowMode)
|
|
{
|
|
case PlayGameModeController.GameMode.Attack:
|
|
setAttackButton.interactable = false;
|
|
break;
|
|
case PlayGameModeController.GameMode.Free:
|
|
setFreeButton.interactable = false;
|
|
break;
|
|
case PlayGameModeController.GameMode.Goto:
|
|
setGotoButton.interactable = false;
|
|
break;
|
|
case PlayGameModeController.GameMode.Stay:
|
|
setStayButton.interactable = false;
|
|
break;
|
|
default:
|
|
Debug.Log("TargetUIController.UIButtonInteractable : Type error");
|
|
break;
|
|
}
|
|
}
|
|
}
|