新建相关脚本

This commit is contained in:
2025-08-23 22:20:37 +08:00
parent 6767dc7019
commit 5ca8118694
20 changed files with 223 additions and 3 deletions

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 81e60ce9e4a944739d285ad0c562a4a0
timeCreated: 1755914112

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 70bbe8d6e0c04cdaa553cacaee37fe59
timeCreated: 1755921259

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1258cbf54dfc4d1c906fd83dfa5943be
timeCreated: 1755921708

View File

@@ -0,0 +1,31 @@
using NBC;
using NBC.Entitas;
namespace NBF.Fishing2
{
/// <summary>
/// 钓组组件
/// </summary>
public class UnitGearComponent : Entity
{
/// <summary>
/// 线长度
/// </summary>
public float LineLength { get; set; }
/// <summary>
/// 旋转速度
/// </summary>
public float ReelSpeed { get; set; }
/// <summary>
/// 打开手电筒
/// </summary>
public bool OpenLight { get; set; }
/// <summary>
/// 鱼竿设置
/// </summary>
public int RedSetting { get; set; }
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3c9a70a1145b41e2ad6c57384d7c922c
timeCreated: 1755921173

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1fb0ee12d9cf40408478e8f9ad9aafdd
timeCreated: 1755915944

View File

@@ -0,0 +1,49 @@
using NBC.Entitas;
using Unity.Mathematics;
namespace NBF.Fishing2
{
public class Unit : Entity
{
public int ConfigId { get; set; } //配置表id
private float3 position; //坐标
public float3 Position
{
get => position;
set
{
float3 oldPos = position;
position = value;
Scene.EventComponent.Publish(new ChangePosition() { Unit = this, OldPos = oldPos });
}
}
public float3 Forward
{
get => math.mul(Rotation, math.forward());
set => Rotation = quaternion.LookRotation(value, math.up());
}
private quaternion rotation;
public quaternion Rotation
{
get => rotation;
set
{
rotation = value;
Scene.EventComponent.Publish(new ChangeRotation() { Unit = this });
}
}
public uint State { get; set; }
public string StateArgs { get; set; }
public void ChangeState(uint state, string args)
{
Scene.EventComponent.Publish(new ChangeState() { Unit = this, State = state, Args = args });
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ff176fc098254fe2a1b48ea26eaf8857
timeCreated: 1755915448

View File

@@ -0,0 +1,22 @@
using Unity.Mathematics;
namespace NBF.Fishing2
{
public struct ChangePosition
{
public Unit Unit;
public float3 OldPos;
}
public struct ChangeRotation
{
public Unit Unit;
}
public struct ChangeState
{
public Unit Unit;
public uint State;
public string Args;
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: cd2dd8a7207544b19be4b51b2a6ef215
timeCreated: 1755915609

View File

@@ -0,0 +1,33 @@
namespace NBF.Fishing2
{
public class UnitStateArgsFactory
{
public static UnitStateArgs Create(Unit unit, string[] args)
{
UnitStateArgs ret = null;
// return new UnitStateArgs()
// {
//
// }
if (ret != null)
{
ret.SetArgs(args);
}
return ret;
}
}
public abstract class UnitStateArgs
{
protected string[] Args;
public void SetArgs(string[] args)
{
Args = args;
OnParseArgs();
}
public abstract void OnParseArgs();
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6afa60e6892f49d0aed14024432ab10d
timeCreated: 1755917036

View File

@@ -0,0 +1,25 @@
namespace NBF.Fishing2
{
public enum UnitType : byte
{
/// <summary>
/// 玩家
/// </summary>
Player = 1,
/// <summary>
/// 鱼
/// </summary>
Fish = 2,
/// <summary>
/// 船
/// </summary>
Boat = 3,
/// <summary>
/// 车
/// </summary>
Car = 4,
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f13efb3457f04307b46bbfc54422cf48
timeCreated: 1755915952

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a0e14a90077c49ed84df06845dc694f0
timeCreated: 1755919232

View File

@@ -0,0 +1,12 @@
using NBC.Entitas;
namespace NBF.Fishing2
{
/// <summary>
/// Unit 对应的 HUD对象
/// </summary>
public class UnitHUDComponent : Entity
{
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7b8cd51029604d83a328fd19b8b80d53
timeCreated: 1755921088

View File

@@ -0,0 +1,15 @@
using NBC.Entitas;
using UnityEngine;
namespace NBF.Fishing2
{
/// <summary>
/// Unit 对应的unity对象组件
/// </summary>
public class UnitUnityComponent : Entity
{
public GameObject GameObject { get; set; }
public Transform Transform { get; set; }
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0d2c42a4bc1347cebc390147a1a95c54
timeCreated: 1755921030

View File

@@ -1,10 +1,7 @@
using System;
using System.Collections.Generic;
using Assets.Scripts.Entity;
using Assets.Scripts.Hotfix;
using FairyGUI;
using NBC;
using NBC.Network;
using UnityEngine;
using UnityEngine.Video;