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

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