public void Interpret(INetworkMediator netMediator, EndPoint sender, IMessage message) { var m = (UpdatePlayerMessage)message; IEngineFacade engine = (IEngineFacade)netMediator.EngineProxy; try { IUnityEntity e = engine.EntityRepository.Get(m.EntityId); var interpolator = e.OwnerGameObject.GetComponent <ICharacterInterpolater>(); Vector3 rot = e.OwnerGameObject.transform.eulerAngles; rot.y = m.RotationY; if (interpolator == null) { e.OwnerGameObject.transform.position = m.Position; e.OwnerGameObject.transform.eulerAngles = rot; } else { Vector3 camRot = interpolator.CameraTransform.localEulerAngles; camRot.x = m.RotationX; interpolator.UpdateInterpolation(m.Position, Quaternion.Euler(rot.x, rot.y, rot.z), Quaternion.Euler(camRot.x, camRot.y, camRot.z)); } } catch (EntityNotFoundException ex) { // TODO: This is getting called before the entity exists netMediator.EngineProxy.Logger.LogException(ex); } }
public void Add(IUnityEntity entity) { if (_entities.ContainsKey(entity.Id)) { throw new EntityAlreadyInRepositoryException(entity.Id); } _entities.Add(entity.Id, entity); }
public bool Exists(IUnityEntity e) { foreach (var kv in _entities) { if (kv.Value == e) { return(true); } } return(false); }
public void Remove(IUnityEntity entity) { _entities.Remove(entity.Id); }