public void Snapshot() { if (_objectSnapshot == null) { _objectSnapshot = new ObjectSnapshot(this); } _objectSnapshot.Snapshot(); }
public UndoMultiInternal(object[] snapshotInstances, string actionString) { ActionString = actionString; SnapshotInstances = snapshotInstances; Snapshot = new ObjectSnapshot[snapshotInstances.Length]; for (var i = 0; i < snapshotInstances.Length; i++) { Snapshot[i] = ObjectSnapshot.CaptureSnapshot(snapshotInstances[i]); } }
public ObjectSnapshot GetSnapshot() { ObjectSnapshot ret = new ObjectSnapshot(); //component snapshots ret.Snapshots = new Dictionary <string, JediumBehaviourSnapshot>(); foreach (var beh in _behaviours) { ret.Snapshots.Add(beh.Value.GetBehaviourType(), beh.Value.GetSnapshot()); } return(ret); }
public ClientGameObject(Guid localId, Guid ownerId, Guid clientId, Guid bundleId, Guid avatarId, string prefab, string address, ObjectSnapshot snap) { _prefab = prefab; _clientId = Test.Instance._clientId; _snapshot = snap; _bundleId = bundleId; _clientId = clientId; _avatarId = avatarId; _serverAddress = address; _ownerId = ownerId; _localId = localId; _log.Info($"Spawning game object {localId}, prefab {prefab}, address {address}, bundle {_bundleId}"); //and start ticking if (Test.Instance.MainSettings.UseUpdateThread) { Context.System.Scheduler.ScheduleTellRepeatedly(TimeSpan.FromSeconds(0), TimeSpan.FromMilliseconds(Test.Instance.MainSettings.UpdateThreadInterval), Self, _tick, ActorRefs.NoSender); } if (avatarId != Guid.Empty) { if (_clientId == localId) { _log.Info($"Spawned player avatar"); Test.Instance._myAvatar = this; } else { _log.Info($"Spawned other player avatar: {localId}"); Test.Instance._otherAvatars.Add(localId, this); } } SetupObject(address); }
public ObjectSnapshot GetSnapshot() { ObjectSnapshot ret = new ObjectSnapshot(); if (_behaviours.ContainsKey(TYPEBEHAVIOUR.ANIMATION)) { ret.HasAnimator = true; } else { ret.HasAnimator = false; } if (_behaviours.ContainsKey(TYPEBEHAVIOUR.TOUCH)) { ret.HasTouchable = true; } else { ret.HasTouchable = false; } JediumTransform trans = (JediumTransform)_behaviours[TYPEBEHAVIOUR.TRANSFORM]; //transform ret.X = trans._posX; ret.Y = trans._posY; ret.Z = trans._posZ; ret.RotX = trans._quatX; ret.RotY = trans._quatY; ret.RotZ = trans._quatZ; ret.RotW = trans._quatW; ret.ScaleX = trans._scaleX; ret.ScaleY = trans._scaleY; ret.ScaleZ = trans._scaleZ; // return(ret); }
void IConnectionObserver.OnSpawnedGameObject(string namePrefab, string nameNotOwnedPrefab, Guid localId, Guid ownerId, Guid bundleId, Guid avatarId, string address, ObjectSnapshot snap) { //TODO - do we need this for avatars only? if (ownerId != _clientId && ownerId != Guid.Empty && avatarId != Guid.Empty) { namePrefab = nameNotOwnedPrefab; } // //TODO - address is obtainable here, but not the methods somehow. Maybe Protobuf? // IGameObject sObj=Sender.Cast<GameObjectRef>(); var obj = Test.Instance.AkkaSystem .ActorOf(Props.Create(() => new ClientGameObject(localId, ownerId, _clientId, bundleId, avatarId, namePrefab, address, snap)), localId.ToString()).Cast <GameObjectRef>(); _spawnedObjects.Add(localId, obj); }
public UndoInternal(object snapshotInstance, string actionString) { ActionString = actionString; SnapshotInstance = snapshotInstance; Snapshot = ObjectSnapshot.CaptureSnapshot(snapshotInstance); }