void CreatePlayerRequest() { var system = Worker.World.GetExistingSystem <SendCreatePlayerRequestSystem>(); if (system == null) { return; } var origin = new Vector3(pos.x, FieldDictionary.WorldHeight, pos.z) + this.Worker.Origin; var point = PhysicsUtils.GetGroundPosition(origin); system.RequestPlayerCreation(SerializeUtils.SerializeArguments(new PlayerInitInfo(side, point - this.Worker.Origin))); }
private void CreatePlayerRequest() { var system = Worker.World.GetExistingSystem <SendCreatePlayerRequestSystem>(); if (system == null) { return; } var pos = startPoint.ToUnityVector(); var point = pos + Vector3.up * height; Debug.Log("Send Player Create"); system.RequestPlayerCreation(SerializeUtils.SerializeArguments(new PlayerInitInfo(side, point - this.Worker.Origin)), PlayerCreated); }
private static EntityTemplate CreatePlayerEntityTemplate(EntityId entityId, string workerId, byte[] serializedArguments) { var clientAttribute = EntityTemplate.GetWorkerAccessAttribute(workerId); var initInfo = SerializeUtils.DeserializeArguments <PlayerInitInfo>(serializedArguments); return(BaseUnitTemplate.CreateAdvancedUnitEntityTemplate(workerId, initInfo.pos.ToCoordinates(), initInfo.side)); //var template = new EntityTemplate(); //template.AddComponent(new Position.Snapshot { Coords = initInfo.pos.ToCoordinates() }, clientAttribute); //template.AddComponent(new Metadata.Snapshot("Player"), serverAttribute); //template.AddComponent(new BulletComponent.Snapshot(), clientAttribute); //template.AddComponent(new PlayerInput.Snapshot(), clientAttribute); //template.AddComponent(new BaseUnitStatus.Snapshot { Side = initInfo.side }, serverAttribute); //TransformSynchronizationHelper.AddTransformSynchronizationComponents(template, clientAttribute); //PlayerLifecycleHelper.AddPlayerLifecycleComponents(template, workerId, serverAttribute); //template.SetReadAccess(UnityClientConnector.WorkerType, MobileClientWorkerConnector.WorkerType, serverAttribute); //template.SetComponentWriteAccess(EntityAcl.ComponentId, serverAttribute); //return template; }