38 lines
945 B
C#
38 lines
945 B
C#
using System;
|
|
using System.Linq;
|
|
using AI;
|
|
using Base;
|
|
using Data;
|
|
using UnityEngine;
|
|
|
|
namespace Entity
|
|
{
|
|
public class Character : Entity
|
|
{
|
|
public CharacterDef characterDef;
|
|
|
|
private void Start()
|
|
{
|
|
aiTree = new JobGiver_RandomWander();
|
|
attributes = new AttributesDef();
|
|
}
|
|
|
|
public void Init()
|
|
{
|
|
if (characterDef == null)
|
|
return;
|
|
}
|
|
|
|
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,
|
|
dir - Position);
|
|
}
|
|
}
|
|
} |