Aimbot-ParallelEnv/Assets/Script/Play/TargetUIController.cs

84 lines
2.7 KiB
C#
Raw Normal View History

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>();
ClearGamePressed();
}
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);
setStayButton.interactable = true;
setAttackButton.interactable = true;
setGotoButton.interactable = false;
setFreeButton.interactable = true;
}
public void SetAttackPressed()
{
mouseInMapCon.ChangeMouseModeTo(MouseInMap.MouseMode.AttackSet);
setStayButton.interactable = true;
setAttackButton.interactable = false;
setGotoButton.interactable = true;
setFreeButton.interactable = true;
}
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;
}
}