(client) chore:Clean code

This commit is contained in:
2025-08-28 16:20:24 +08:00
parent 909e995e15
commit c3bff1cf88
76 changed files with 5689 additions and 445 deletions

View File

@ -22,6 +22,6 @@ namespace Entity
attackTargetCount = def.attackTargetCount;
}
public Attributes()
{}
{ }
}
}

View File

@ -1,10 +1,8 @@
using Base;
using Data;
using UnityEngine;
namespace Entity
{
public class Building:Entity
public class Building : Entity
{
public override void SetTarget(Vector3 pos)
{

View File

@ -2,7 +2,7 @@ using UnityEngine;
namespace Entity
{
public class BuildingOutline:Outline
public class BuildingOutline : Outline
{
public BoxCollider2D boxCollider;
override public void Init()

View File

@ -1,7 +1,5 @@
using System;
using Base;
using Data;
using Prefab;
using UnityEngine;
namespace Entity
@ -10,7 +8,7 @@ namespace Entity
{
public Entity bulletSource;
public float lifeTime = 10;
public override void SetTarget(Vector3 pos)
{
base.SetTarget(pos);
@ -20,7 +18,7 @@ namespace Entity
protected override void AutoBehave()
{
TryMove();
lifeTime-=Time.deltaTime;
lifeTime -= Time.deltaTime;
if (lifeTime <= 0)
{
Kill();
@ -55,7 +53,7 @@ namespace Entity
// 计算当前向上方向与目标方向之间的角度
var angle = Mathf.Atan2(targetDirection.y, targetDirection.x) * Mathf.Rad2Deg;
// 应用旋转
transform.rotation = Quaternion.Euler(0f, 0f, angle);

View File

@ -1,10 +1,6 @@
using System;
using System.Linq;
using Data;
using Item;
using Managers;
using UnityEngine;
using Utils;
// 添加 System 命名空间以使用 Action
namespace Entity
@ -29,7 +25,7 @@ namespace Entity
}
public Inventory Inventory { get; private set; }
public override void Init(EntityDef entityDef)
{

View File

@ -1,13 +1,13 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using AI;
using Base;
using Data;
using Item;
using Managers;
using Prefab;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
@ -177,7 +177,7 @@ namespace Entity
public virtual void Init(EntityDef entityDef)
{
attributes = new Attributes(entityDef.attributes);
aiTree = Utils.BehaviorTree.ConvertToAIBase(entityDef.behaviorTree);
aiTree = AI.BehaviorTree.ConvertToAIBase(entityDef.behaviorTree);
affiliation = entityDef.affiliation?.defName;
InitBody(entityDef.drawingOrder);
this.entityDef = entityDef;
@ -219,7 +219,7 @@ namespace Entity
// 实例化imagePrefab作为默认占位符
targetObj = Instantiate(imagePrefab.gameObject, body.transform);
targetObj.name = $"{state}_{orientation}_Default";
targetObj.transform.localPosition=Vector3.zero;
targetObj.transform.localPosition = Vector3.zero;
var imagePrefabCom = targetObj.GetComponent<ImagePrefab>();
if (imagePrefabCom != null)
{

View File

@ -1,6 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using Item;
using UnityEngine;
namespace Entity

View File

@ -4,7 +4,7 @@ using Managers;
namespace Entity
{
public class Monster:Entity
public class Monster : Entity
{
private WeaponResource weapon;
public override void Init(EntityDef entityDef)

View File

@ -1,6 +1,6 @@
using System.Collections.Generic;
using Managers;
using Prefab;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
@ -9,15 +9,15 @@ namespace Entity
public class Outline : MonoBehaviour
{
public RightMenuPrefab rightMenuPrefab;
public GameObject body;
public SpriteRenderer outlineRenderer;
public CapsuleCollider2D outlineCollider;
public ProgressBarPrefab progressBarPrefab;
public Entity entity;
public static Vector3 minimum=new(0.5f,0.5f,0.5f);
public static Vector3 minimum = new(0.5f, 0.5f, 0.5f);
public virtual void Init()
{
@ -116,7 +116,7 @@ namespace Entity
private void BecomeDefault()
{
entity.Kill();
EntityManage.Instance.GenerateDefaultEntity(Program.Instance.FocusedDimensionId,entity.Position);
EntityManage.Instance.GenerateDefaultEntity(Program.Instance.FocusedDimensionId, entity.Position);
}
private void StartControl()

View File

@ -1,15 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Base;
using Data;
using Item;
using Prefab;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace Entity
{
public class Pickup:Entity
public class Pickup : Entity
{
public ItemResource itemResource;
protected override void AutoBehave()
@ -18,7 +18,7 @@ namespace Entity
public override void SetTarget(Vector3 pos)
{
}
public void Init(ItemDef itemDef)