feat: replay flow

master
tiendat3699 2024-04-11 17:21:13 +07:00
parent 5f9e8f0b66
commit b33bf2148c
4 changed files with 24 additions and 2 deletions

View File

@ -1,4 +1,6 @@
using UnityEngine.Serialization;
namespace GadGame.Network
{
public enum Genders
@ -11,7 +13,7 @@ namespace GadGame.Network
public struct ReceiverData
{
public bool PassBy;
public bool Viewed;
public bool OnVision;
public bool Engage;
public bool Ready;
public Genders Gender;

View File

@ -16,6 +16,16 @@ namespace GadGame.State
public override void Update()
{
if (!Receiver.Instance.DataReceived.PassBy)
{
Runner.SetState(typeof(IdleState));
return;
}
if (!Receiver.Instance.DataReceived.Engage)
{
Runner.SetState(typeof(ViewedState));
return;
}
if (!Receiver.Instance.DataReceived.Ready) _timer = 0;
_timer += Time.deltaTime;
if (_timer >= 5)

View File

@ -13,7 +13,12 @@ namespace GadGame.State
public override void Update()
{
if (Receiver.Instance.DataReceived.Viewed)
if (!Receiver.Instance.DataReceived.PassBy)
{
Runner.SetState(typeof(IdleState));
return;
}
if (Receiver.Instance.DataReceived.OnVision)
{
Runner.SetState(typeof(ViewedState));
}

View File

@ -12,6 +12,11 @@ namespace GadGame.State
public override void Update()
{
if (!Receiver.Instance.DataReceived.PassBy)
{
Runner.SetState(typeof(IdleState));
return;
}
if (Receiver.Instance.DataReceived.Engage)
{
Runner.SetState(typeof(EngageState));