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);
            }
        }
Exemplo n.º 2
0
 public void Add(IUnityEntity entity)
 {
     if (_entities.ContainsKey(entity.Id))
     {
         throw new EntityAlreadyInRepositoryException(entity.Id);
     }
     _entities.Add(entity.Id, entity);
 }
Exemplo n.º 3
0
 public bool Exists(IUnityEntity e)
 {
     foreach (var kv in _entities)
     {
         if (kv.Value == e)
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 4
0
 public void Remove(IUnityEntity entity)
 {
     _entities.Remove(entity.Id);
 }