blob: b03effa872e5e7d0becadde3974599352b7372e9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
using WK.Data;
namespace WK
{
[StructLayout(LayoutKind.Explicit)]
public struct CharacterStatsValue
{
[FieldOffset(0)]
public int i;
[FieldOffset(0)]
public float f;
[FieldOffset(0)]
public bool boolean;
[FieldOffset(0)]
public char c;
[FieldOffset(0)]
public Vector2 v2;
[FieldOffset(0)]
public Vector3 v3;
[FieldOffset(0)]
public Vector4 v4;
[FieldOffset(0)]
public Color color;
}
/// <summary>
/// 运行时角色基础属性
/// </summary>
public abstract class CharacterStats
{
/// <summary>
/// 表格数据
/// </summary>
public CharacterStatsMetadata metadata;
/// <summary>
/// 当前属性值
/// </summary>
public CharacterStatsValue value;
public ref int intValue => ref value.i;
public ref bool boolValue => ref value.boolean;
public ref float floatValue => ref value.f;
public ref char chartValue => ref value.c;
public ref Vector2 Vector2Value => ref value.v2;
public ref Vector3 Vector3Value => ref value.v3;
public ref Vector4 Vector4Value => ref value.v4;
public string uid
{
get
{
return metadata.uid;
}
}
}
}
|