private void CreateClientBag(BagDto serverBag) { world.NewEntityWith(out CreateResourceEvent resEvent); resEvent.Count = serverBag.GoldCount; resEvent.Tag = ResourceTag.Money; resEvent.Position = serverBag.Position.ToUnityVector(); resEvent.Id = serverBag.Id; }
public static void CreateAddingMoneyBagEventOnZavod(EcsEntity zavod) { var zavodComponent = zavod.Get <ZavodComponent>(); var resourceComponent = zavod.Get <ResourceGeneratorComponent>(); resourceComponent.LastGeneratedMoneyTime = Time.time; var randAngle = UnityEngine.Random.Range(0, 360 / bagSpawnersCount) * bagSpawnersCount; var bagPosition = zavodComponent.Position + new UnityEngine.Vector3(xZavodScale * Mathf.Sin(randAngle), 0, zZavodScale * Mathf.Cos(randAngle)); var bagDto = new BagDto() { Id = Guid.NewGuid(), GoldCount = resourceComponent.GenerateMoneyCount, Position = bagPosition.ToModelsVector() }; ServerClient.Communication.ClientInfoReceiver.ToServerCreateBag.Add(bagDto.Id, bagDto); }
private void DropResource(ResourceComponent resource) { switch (resource.Tag) { //TODO: Add semek's prefab case ResourceTag.Semki: { break; } case ResourceTag.Money: { var bagDto = new BagDto() { Id = Guid.NewGuid(), GoldCount = resource.ResourceCount, Position = resource.Position.ToModelsVector() }; ServerClient.Communication.ClientInfoReceiver.ToServerCreateBag.Add(bagDto.Id, bagDto); break; } } }
public Bag(BagDto basea) { Extensions.AnonymousMap(this, basea); }