Fix UIWaitingTimer and client status

This commit is contained in:
Antoine H 2021-01-07 14:00:22 +01:00
parent c7e6219b9e
commit caf73dfc25
2 changed files with 18 additions and 15 deletions

View file

@ -7699,7 +7699,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_SortingOrder: 5
m_Sprite: {fileID: 21300000, guid: 17d59b2d4d882c04480a40119a442279, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0

View file

@ -29,12 +29,25 @@ public class Client_controller : MonoBehaviour, IUsable
agent.Warp(agent.destination); //Make sure agent become static at right position
agent.enabled = false;
navObstacle.enabled = true;
if(UIWaitingTimer != null)
{
UIWaitingTimer.DisplayIcon(true);
UIWaitingTimer.SetValue(1.0f);
UIWaitingTimer.gameObject.SetActive(true);
}
}
else
{
if(UIWaitingTimer != null)
UIWaitingTimer.gameObject.SetActive(false);
if(value=="entering"||value=="leaving")
{
navObstacle.enabled = false;
agent.enabled = true;
}
}
// navObstacle.enabled = value=="waiting";
// agent.enabled = value!="waiting";
}
@ -53,7 +66,7 @@ public class Client_controller : MonoBehaviour, IUsable
//Return wether the object is taken from tavernkeeper
public bool use(GameObject object_used)
{
if(currentMug is null) //No mug in hand
if(status == "waiting" && currentMug is null) //No mug in hand
{
//TODO : Gérer Grabale qui ne sont pas des Mugs ?
if(object_used != null && object_used.tag=="Grabable")
@ -124,12 +137,6 @@ public class Client_controller : MonoBehaviour, IUsable
{
status="waiting";
waitTimer=waitingTime;
if(UIWaitingTimer != null)
{
UIWaitingTimer.DisplayIcon(true);
UIWaitingTimer.SetValue(1.0f);
UIWaitingTimer.gameObject.SetActive(true);
}
}
if(status=="waiting")
@ -137,9 +144,6 @@ public class Client_controller : MonoBehaviour, IUsable
waitTimer -= Time.deltaTime;
if (waitTimer < 0) //Waited too long
{
//Disable UI Waiting timer
if(UIWaitingTimer != null)
UIWaitingTimer.gameObject.SetActive(false);
//Leave tavern
status = "leaving";
agent.SetDestination(ClientManager.Instance.assignTarget(agent.destination)); //Request next target
@ -149,8 +153,7 @@ public class Client_controller : MonoBehaviour, IUsable
}
//Consume Timer
//TODO : Make Client Obstacle when consumming
if(status=="consuming" && !agent.pathPending && agent.remainingDistance==0) //Consuming mug if there's one and reached destination
if(status=="consuming") //Consuming mug if there's one and reached destination
{
consumeTimer -= Time.deltaTime;
if (consumeTimer < 0) //Finished consuming mug ?