2025-07-14 11:42:02 +08:00
|
|
|
using System;
|
|
|
|
using System.Linq;
|
2025-07-21 13:58:58 +08:00
|
|
|
using AI;
|
|
|
|
using Base;
|
2025-07-14 11:42:02 +08:00
|
|
|
using Data;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace Entity
|
|
|
|
{
|
2025-07-21 13:58:58 +08:00
|
|
|
public class Character : Entity
|
2025-07-14 11:42:02 +08:00
|
|
|
{
|
2025-07-21 13:58:58 +08:00
|
|
|
public CharacterDef characterDef;
|
2025-08-17 11:16:55 +08:00
|
|
|
|
2025-07-14 11:42:02 +08:00
|
|
|
private void Start()
|
|
|
|
{
|
2025-08-13 22:53:57 +08:00
|
|
|
aiTree = new JobGiver_RandomWander();
|
2025-07-25 19:16:58 +08:00
|
|
|
attributes = new AttributesDef();
|
2025-07-14 11:42:02 +08:00
|
|
|
}
|
|
|
|
|
2025-07-21 13:58:58 +08:00
|
|
|
public void Init()
|
2025-07-14 11:42:02 +08:00
|
|
|
{
|
2025-07-21 13:58:58 +08:00
|
|
|
if (characterDef == null)
|
2025-07-14 11:42:02 +08:00
|
|
|
return;
|
|
|
|
}
|
2025-08-17 11:16:55 +08:00
|
|
|
|
|
|
|
public override void TryAttack()
|
|
|
|
{
|
|
|
|
if (IsAttacking)
|
|
|
|
return;
|
|
|
|
if (!Managers.DefineManager.Instance.defines.TryGetValue(nameof(BulletDef), out var def))
|
|
|
|
return;
|
|
|
|
var buttonDef = def.Values.First();
|
|
|
|
Vector3 dir = Utils.MousePosition.GetWorldPosition();
|
|
|
|
Managers.EntityManage.Instance.GenerateBulletEntity((BulletDef)buttonDef, Position,
|
2025-08-19 14:36:22 +08:00
|
|
|
dir - Position, this);
|
2025-08-17 11:16:55 +08:00
|
|
|
}
|
2025-07-14 11:42:02 +08:00
|
|
|
}
|
|
|
|
}
|