Beispiel #1
0
        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);
        }
Beispiel #2
0
 private bool IsInTargets(SyncEntity entity)
 {
     foreach (var tar in targets)
     {
         if (tar.entity == entity)
         {
             return(true);
         }
     }
     return(false);
 }
Beispiel #3
0
        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;
        }
Beispiel #4
0
 private void Start()
 {
     attachedEntity = GetComponent <SyncEntity>();
 }
Beispiel #5
0
        public static string EncodeSyncEntity(SyncEntity src)
        {
            var syncBody = new SyncEntityPrototype(src);

            return(syncBody.Encode());
        }
Beispiel #6
0
 virtual protected void Start()
 {
     attachedEntity = GetComponent <SyncEntity>();
 }
Beispiel #7
0
 public MovementEntity(SyncEntity entity, SyncTransform transform)
 {
     this.entity        = entity;
     this.syncTransform = transform;
     this.decorator     = entity.GetComponent <MovementDecorator>();
 }
Beispiel #8
0
 // 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>());
 }