Ashby Issac c466e28d6c AI FSM changes.
- Protoyped on the AI movement, found solutions for turns and
   moving after impacting the player.
- Created a full base for AI state machine.
- Worked on binding the core AI logic with the finite state machine.
2026-01-07 19:38:03 +05:30

51 lines
1.1 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TimerSystem
{
private float timeRem;
private float maxTimeAvail;
private Action onTimerComplete = null;
private Action onTimerInProgress = null;
public bool IsTimerComplete
{
get;
private set;
}
public bool IsInitialized
{
get;
private set;
}
public void Init(float maxTimeAvail, Action onComplete = null, Action inProgress = null, Action onStart = null)
{
timeRem = 0;
IsTimerComplete = false;
IsInitialized = true;
this.maxTimeAvail = maxTimeAvail;
this.onTimerComplete = onComplete;
this.onTimerInProgress = inProgress;
}
public void UpdateTimer(float deltaTime)
{
if (timeRem < maxTimeAvail)
{
timeRem += deltaTime;
onTimerInProgress?.Invoke();
}
else
{
timeRem = 0;
onTimerComplete?.Invoke();
IsTimerComplete = true;
}
}
}