脚本相关

This commit is contained in:
2025-09-14 21:22:39 +08:00
parent 3c022ff4b6
commit cde46100ff
4 changed files with 10 additions and 2 deletions

View File

@@ -1,3 +1,8 @@
fileFormatVersion: 2
guid: 370fe07e6dd1446298721033a240b4fd
timeCreated: 1756363974
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -9,6 +9,7 @@ namespace NBF.Fishing2
{
protected override void Handler(NumericChange self)
{
if (self.Old == self.New) return;
if (self.NumericType == NumericType.Flashlight)
{
var flashlight = self.MapUnit.GetComponent<FlashlightComponent>();

View File

@@ -8,6 +8,7 @@ namespace NBF.Fishing2
{
protected override async FTask Run(Session session, Map2C_RolePropertyChangeNotify message)
{
Log.Info($"收到角色属性推送 id={message.Id}");
var map = App.Main.GetComponent<Map>();
var unit = map.Units[message.Id];
var numericComponent = unit.GetComponent<NumericComponent>();

View File

@@ -23,7 +23,8 @@ namespace NBF.Fishing2
GameObject = gameObject;
Transform = gameObject.transform;
Asset = gameObject.GetComponent<PlayerAsset>();
Parent.AddComponent<FlashlightComponent>();
Parent.GetOrAddComponent<FlashlightComponent>();
Parent.GetOrAddComponent<CharacterControllerComponent>();
}