Gameclient #9

Closed
Trubkokrtek wants to merge 3 commits from Gameclient into main
Showing only changes of commit 43a3434e97 - Show all commits

View File

@@ -10,7 +10,7 @@ public class Station : IInteractable
public PlayerRole? ReqRole { get; set; } public PlayerRole? ReqRole { get; set; }
public float InteractionRange { get; set; } public float InteractionRange { get; set; }
protected GameObject interfaceInstance; protected GameObject interfaceInstance;
public GameObject Interface; // Prefab pro interakci (napø. UI pro úkol nebo sabotáže) public GameObject Interface { get; set; } // Prefab pro interakci (napø. UI pro úkol nebo sabotáže)
public virtual void Interact(PlayerRole role) public virtual void Interact(PlayerRole role)
{ {
@@ -21,7 +21,7 @@ public class Station : IInteractable
} }
else else
{ {
interfaceInstance = UnityEngine.Object.Instantiate(Interface); // Zobrazí interakèní UI interfaceInstance = UnityEngine.Object.Instantiate(Interface); // Zobrazí interakèní UI
} }
@@ -34,7 +34,7 @@ public class Station : IInteractable
} }
public class TaskStation : Station public class TaskStation : Station
{ {
public string TaskID { get; set; } // Unikátní ID úkolu pro server public string TaskID { get; set; } // Unikátní ID úkolu pro server
private GameClient _gameClient; private GameClient _gameClient;
public TaskStation(Position pos, float interactionRange, GameClient gameClient, string taskID) : base(pos, interactionRange) public TaskStation(Position pos, float interactionRange, GameClient gameClient, string taskID) : base(pos, interactionRange)
{ {
@@ -57,7 +57,7 @@ public class TaskStation : Station
} }
private void ResumeTask() private void ResumeTask()
{ {
interfaceInstance.SetActive(true); // Zobrazí interakèní UI interfaceInstance.SetActive(true); // Zobrazí interakèní UI
} }
private void OnTaskCompleted(ITask task) private void OnTaskCompleted(ITask task)
{ {
@@ -69,12 +69,12 @@ public class TaskStation : Station
{ {
if (task.IsCompleted) if (task.IsCompleted)
{ {
UnityEngine.Object.Destroy(interfaceInstance); // Znièí interakèní UI UnityEngine.Object.Destroy(interfaceInstance); // Znièí interakèní UI
Debug.Log($"Task {task.TaskName} completed and sent to server."); Debug.Log($"Task {task.TaskName} completed and sent to server.");
} }
else else
{ {
interfaceInstance.SetActive(false); // Skryje interakèní UI interfaceInstance.SetActive(false); // Skryje interakèní UI
Debug.Log($"Task {task.TaskName} was not completed, but exited."); Debug.Log($"Task {task.TaskName} was not completed, but exited.");
} }