2021-12-13 04:02:26 +01:00
|
|
|
using System;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
2022-03-05 04:41:06 +01:00
|
|
|
public class InputBufferItem
|
2021-12-13 04:02:26 +01:00
|
|
|
{
|
2022-11-15 16:16:53 +02:00
|
|
|
private readonly int _timeBeforeActionsExpire = 20;
|
|
|
|
|
public int _timestamp;
|
|
|
|
|
public InputEnum _inputEnum;
|
2022-11-15 21:39:40 +02:00
|
|
|
public int _priority;
|
2021-12-13 04:02:26 +01:00
|
|
|
public Func<bool> Execute;
|
|
|
|
|
|
2022-11-15 16:16:53 +02:00
|
|
|
public InputBufferItem(InputEnum inputEnum, int timestamp)
|
2021-12-13 04:02:26 +01:00
|
|
|
{
|
2022-11-15 16:16:53 +02:00
|
|
|
_inputEnum = inputEnum;
|
2021-12-13 04:02:26 +01:00
|
|
|
_timestamp = timestamp;
|
2022-11-15 21:39:40 +02:00
|
|
|
_priority = (int)inputEnum;
|
2021-12-13 04:02:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool CheckIfValid()
|
|
|
|
|
{
|
2022-11-14 14:20:37 +02:00
|
|
|
if (_timestamp + _timeBeforeActionsExpire >= DemonicsWorld.Frame)
|
2021-12-13 04:02:26 +01:00
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|