private void AddNewObject(ushort id, ViewTransformCompressed viewTransform) { ServerGameEntity gameEntity = gameContext.CreateEntity(); gameEntity.AddId(id); gameEntity.AddViewType(viewTransform.viewTypeEnum); Quaternion quaternion = Quaternion.AngleAxis(viewTransform.Angle, Vector3.up); gameEntity.AddSpawnTransform(viewTransform.GetPosition(), quaternion); }
private void UpdateTransform(ServerGameEntity entity, ViewTransformCompressed viewTransform) { ushort playerId = PlayerIdStorage.PlayerEntityId; if (entity.id.value == playerId) { return; } Vector3 vector = viewTransform.GetPosition(); entity.transform.value.position = vector; entity.transform.value.rotation = Quaternion.AngleAxis(viewTransform.Angle, Vector3.up); ViewTypeEnum oldViewType = entity.viewType.value; if (oldViewType != viewTransform.viewTypeEnum) { string mes = $"Смена типа сущности. Было {oldViewType.ToString()} стало {viewTransform.viewTypeEnum}"; log.Debug(mes); entity.ReplaceViewType(viewTransform.viewTypeEnum); } }