新建相关脚本
This commit is contained in:
3
Assets/Scripts/Fishing2/Data.meta
Normal file
3
Assets/Scripts/Fishing2/Data.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81e60ce9e4a944739d285ad0c562a4a0
|
||||
timeCreated: 1755914112
|
||||
3
Assets/Scripts/Fishing2/Data/Gear.meta
Normal file
3
Assets/Scripts/Fishing2/Data/Gear.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 70bbe8d6e0c04cdaa553cacaee37fe59
|
||||
timeCreated: 1755921259
|
||||
3
Assets/Scripts/Fishing2/Data/Gear/Configs.meta
Normal file
3
Assets/Scripts/Fishing2/Data/Gear/Configs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1258cbf54dfc4d1c906fd83dfa5943be
|
||||
timeCreated: 1755921708
|
||||
31
Assets/Scripts/Fishing2/Data/Gear/UnitGearComponent.cs
Normal file
31
Assets/Scripts/Fishing2/Data/Gear/UnitGearComponent.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c9a70a1145b41e2ad6c57384d7c922c
|
||||
timeCreated: 1755921173
|
||||
3
Assets/Scripts/Fishing2/Data/Unit.meta
Normal file
3
Assets/Scripts/Fishing2/Data/Unit.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1fb0ee12d9cf40408478e8f9ad9aafdd
|
||||
timeCreated: 1755915944
|
||||
49
Assets/Scripts/Fishing2/Data/Unit/Unit.cs
Normal file
49
Assets/Scripts/Fishing2/Data/Unit/Unit.cs
Normal 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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Fishing2/Data/Unit/Unit.cs.meta
Normal file
3
Assets/Scripts/Fishing2/Data/Unit/Unit.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ff176fc098254fe2a1b48ea26eaf8857
|
||||
timeCreated: 1755915448
|
||||
22
Assets/Scripts/Fishing2/Data/Unit/UnitEventType.cs
Normal file
22
Assets/Scripts/Fishing2/Data/Unit/UnitEventType.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Fishing2/Data/Unit/UnitEventType.cs.meta
Normal file
3
Assets/Scripts/Fishing2/Data/Unit/UnitEventType.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd2dd8a7207544b19be4b51b2a6ef215
|
||||
timeCreated: 1755915609
|
||||
33
Assets/Scripts/Fishing2/Data/Unit/UnitStateArgs.cs
Normal file
33
Assets/Scripts/Fishing2/Data/Unit/UnitStateArgs.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Fishing2/Data/Unit/UnitStateArgs.cs.meta
Normal file
3
Assets/Scripts/Fishing2/Data/Unit/UnitStateArgs.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6afa60e6892f49d0aed14024432ab10d
|
||||
timeCreated: 1755917036
|
||||
25
Assets/Scripts/Fishing2/Data/Unit/UnitType.cs
Normal file
25
Assets/Scripts/Fishing2/Data/Unit/UnitType.cs
Normal 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,
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Fishing2/Data/Unit/UnitType.cs.meta
Normal file
3
Assets/Scripts/Fishing2/Data/Unit/UnitType.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f13efb3457f04307b46bbfc54422cf48
|
||||
timeCreated: 1755915952
|
||||
3
Assets/Scripts/Fishing2/Player/Unit.meta
Normal file
3
Assets/Scripts/Fishing2/Player/Unit.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a0e14a90077c49ed84df06845dc694f0
|
||||
timeCreated: 1755919232
|
||||
12
Assets/Scripts/Fishing2/Player/Unit/UnitHUDComponent.cs
Normal file
12
Assets/Scripts/Fishing2/Player/Unit/UnitHUDComponent.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using NBC.Entitas;
|
||||
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
/// <summary>
|
||||
/// Unit 对应的 HUD对象
|
||||
/// </summary>
|
||||
public class UnitHUDComponent : Entity
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b8cd51029604d83a328fd19b8b80d53
|
||||
timeCreated: 1755921088
|
||||
15
Assets/Scripts/Fishing2/Player/Unit/UnitUnityComponent.cs
Normal file
15
Assets/Scripts/Fishing2/Player/Unit/UnitUnityComponent.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0d2c42a4bc1347cebc390147a1a95c54
|
||||
timeCreated: 1755921030
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user