started working inventory system

This commit is contained in:
unknown
2025-10-06 15:32:09 +01:00
parent 4d2c0a595d
commit 1ee08ea649
564 changed files with 129649 additions and 355 deletions

View File

@@ -13,12 +13,7 @@ public class Enemy : Character
private State curState = State.Idle;
[Header("Ranges")]
[SerializeField] private float chaseRange;
[SerializeField] private float attackRange;
[Header("Attack")]
[SerializeField] private float attackRate;
private float lastAttackTime;
[SerializeField] private GameObject attackPrefab;
@@ -75,30 +70,30 @@ public class Enemy : Character
// Called every frame while in the IDLE state.
void IdleUpdate()
{
if (targetDistance < chaseRange && targetDistance > attackRange)
if (targetDistance < ChaseRange && targetDistance > AttackRange)
SetState(State.Chase);
else if (targetDistance < attackRange)
else if (targetDistance < AttackRange)
SetState(State.Attack);
}
// Called every frame while in the CHASE state.
void ChaseUpdate ()
{
if (targetDistance > chaseRange)
if (targetDistance > ChaseRange)
SetState(State.Idle);
else if (targetDistance < attackRange)
else if (targetDistance < AttackRange)
SetState(State.Attack);
}
// Called every frame while in the ATTACK state.
void AttackUpdate ()
{
if (targetDistance > attackRange)
if (targetDistance > AttackRange)
SetState(State.Chase);
Controller.LookTowards(target.transform.position - transform.position);
if(Time.time - lastAttackTime > attackRate)
if(Time.time - lastAttackTime > AttackRate)
{
lastAttackTime = Time.time;
AttackTarget();