public override Object ToOriginal() { var original = new SyncEntity(); original.sceneUID = this.sceneUID; original.mirrorObjectID = this.mirrorObjectID; var decodedStates = new List <SyncComponent>(); foreach (var jsonStr in syncStateJSONs) { try { var decoded = JsonUtility.FromJson <SyncComponent>(jsonStr); decodedStates.Add(decoded); } catch { throw; } } original.syncStates = decodedStates.ToArray(); return(original); }
private bool IsInTargets(SyncEntity entity) { foreach (var tar in targets) { if (tar.entity == entity) { return(true); } } return(false); }
public SyncEntityPrototype(SyncEntity syncEntity) { var jsonfiedStates = new List <string>(); foreach (var state in syncEntity.syncStates) { jsonfiedStates.Add(JsonUtility.ToJson(state)); } this.syncStateJSONs = jsonfiedStates.ToArray(); this.sceneUID = syncEntity.sceneUID; this.mirrorObjectID = syncEntity.mirrorObjectID; }
private void Start() { attachedEntity = GetComponent <SyncEntity>(); }
public static string EncodeSyncEntity(SyncEntity src) { var syncBody = new SyncEntityPrototype(src); return(syncBody.Encode()); }
virtual protected void Start() { attachedEntity = GetComponent <SyncEntity>(); }
public MovementEntity(SyncEntity entity, SyncTransform transform) { this.entity = entity; this.syncTransform = transform; this.decorator = entity.GetComponent <MovementDecorator>(); }
// defineation of movment entity is: // 1-have syncTransfrom component // 2-isn't local authority private bool IsMovementEntity(SyncEntity entity) { return(entity.authorityType != SyncEntity.AuthorityType.local && entity.GetComponent <SyncTransform>()); }