Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions Assets/Scripts/GameProcess/Buttons/Turn.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using UnityEngine;
using UnityEngine.UI;

public class Turn : MonoBehaviour
{
public bool isClickable { get; set; }

private string ButtonText{
get => this.GetComponentInChildren<Text>().text;
set => this.GetComponentInChildren<Text>().text = value;
}
// Start is called before the first frame update
void Start()
{

}

public void Initialise(bool isEnemyTurn){
this.isClickable = !isEnemyTurn;
this.SetButtonText();
}

// Update is called once per frame
void Update()
{

}

// public static void TaskOnClick(Turn button) {
// button.isClickable = !button.isClickable;
// Debug.Log("Is button clicable:" + button.isClickable);
// button.SetButtonText();
// }

public void SetButtonText(){
string text = this.isClickable? TurnText.PASS_TURN:TurnText.ENEMY_TURN;
this.ButtonText = text;

}
}
11 changes: 11 additions & 0 deletions Assets/Scripts/GameProcess/Buttons/Turn.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Assets/Scripts/GameProcess/Buttons/TurnText.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
public static class TurnText{
public static readonly string PASS_TURN = "Pass turn";
public static readonly string ENEMY_TURN = "Enemy turn";
}
11 changes: 11 additions & 0 deletions Assets/Scripts/GameProcess/Buttons/TurnText.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading