-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy pathUGFEntity.cs
52 lines (47 loc) · 1.58 KB
/
UGFEntity.cs
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
using System;
using MongoDB.Bson.Serialization.Attributes;
using UnityEngine;
namespace ET
{
[ChildOf]
public sealed class UGFEntity : Entity, IAwake<long, ETMonoEntity>, IDestroy
{
[BsonIgnore]
public UnityGameFramework.Runtime.Entity Entity { get; private set; }
public long EntityEventTypeLongHashCode { get; private set; }
[BsonIgnore]
public Transform Transform { get; private set; }
public bool IsShow => ETMonoEntity.IsShow;
[BsonIgnore]
public ETMonoEntity ETMonoEntity { get; private set; }
internal void OnAwake(long entityEventTypeLongHashCode, ETMonoEntity etMonoEntity)
{
ETMonoEntity = etMonoEntity;
EntityEventTypeLongHashCode = entityEventTypeLongHashCode;
Transform = etMonoEntity.CachedTransform;
Entity = etMonoEntity.Entity;
}
internal void OnDestroy()
{
ETMonoEntity = default;
EntityEventTypeLongHashCode = default;
Transform = default;
Entity = default;
}
}
[EntitySystemOf(typeof(UGFEntity))]
[FriendOf(typeof(UGFEntity))]
public static partial class UGFEntitySystem
{
[EntitySystem]
private static void Awake(this UGFEntity self, long entityEventTypLongHashCode, ETMonoEntity etMonoEntity)
{
self.OnAwake(entityEventTypLongHashCode, etMonoEntity);
}
[EntitySystem]
private static void Destroy(this UGFEntity self)
{
self.OnDestroy();
}
}
}