public void Construction() { if (!isConverted) { return; } // Refactor this & validate resource spending (send array) foreach (var price in prices) { bool validationStatus = playerResourceSystem.ValidateResourceSpending(price.type, (int)price.value); if (!validationStatus) { Debug.Log($"Not enough {price.type}!"); buildingSystem.Enabled = false; return; } } buildingSystem.SetBuildingPrice(prices); Debug.Log($"Construction Task Notify: {taskEntity}"); var notify = manager.CreateEntity(typeof(ConstructionTaskNotify)); manager.AddComponentData <ConstructionTaskNotify>(notify, new ConstructionTaskNotify { task = taskEntity }); }
private void SpendResources() { foreach (var price in prices) { bool validationStatus = playerResourceSystem.ValidateResourceSpending(price.type, (int)price.value); if (!validationStatus) { return; } playerResourceSystem.SpendResource(price.type, (int)price.value); } }