private void Collect() { if (audioElement != null && Time.timeScale > 0) { audioElement.Play(harvestSound); } float collect = collectionAmount * Time.deltaTime; // Make sure that the harvester cannot collect more than it can carry if (currentLoad + collect > capacity) { collect = capacity - currentLoad; } if (resourceDeposit.isEmpty()) { Arms[] arms = GetComponentsInChildren <Arms>(); foreach (Arms arm in arms) { arm.renderer.enabled = false; } DecideWhatToDo(); } else { resourceDeposit.Remove(collect); } currentLoad += collect; }
/// <summary> /// Build a turret on a selected Node /// </summary> /// <param name="node"></param> void BuildTurret(TurretBlueprint blueprint) { //Checks if the player has enough money to build a turret if (PlayerStats.Money < blueprint.cost || resource.GetAmount() < 1) { return; } //Deduct the cost PlayerStats.Money -= blueprint.cost; //Deduct one turret token for each turret bought resource.Remove(1); //Create new turret at the location of the current Node with no rotation GameObject _turret = (GameObject)Instantiate(blueprint.prefab, GetBuildPosition(), Quaternion.identity); //Set the Node turret equal to the just created turret object turret = _turret; turretBlueprint = blueprint; //Create a buildeffect object that can be destroyed again after 5 seconds GameObject effect = (GameObject)Instantiate(buildManager.buildEffect, GetBuildPosition(), Quaternion.identity); Destroy(effect, 5f); }
private void Collect() { float collect = collAmt * Time.deltaTime; if (currLoad + collect > capacity) { collect = capacity - currLoad; } resDeposit.Remove(collect); currLoad += collect; }
private void Collect() { float collect = collectionAmount * Time.deltaTime; //make sure that the harvester cannot collect more than it can carry if (currentLoad + collect > capacity) { collect = capacity - currentLoad; } resourceDeposit.Remove(collect); currentLoad += collect; }
public void TryRemoveMaterials(int value, out bool flag) { if (_materials.IsEnough(value)) { _materials.Remove(value); flag = true; } else { flag = false; } }
public void TryRemoveCredits(int value, out bool flag) { if (_credits.IsEnough(value)) { _credits.Remove(value); flag = true; } else { flag = false; } }
private void Collect() { currentLoad += collectionAmount * Time.deltaTime; currentDeposit += collectionAmount * Time.deltaTime; int deposit = Mathf.FloorToInt(currentDeposit); if (deposit >= 1) { currentDeposit -= deposit; resourceDeposit.Remove(deposit); } }
public void BuildUnit(int index) { var tile = Map.getEmptyTile(); if (tile != null) { var unit = UnitPrefabs[index]; if (GoldResource.Remove(unit.Cost)) { TurnManager.CurrentPlayer.AddUnit(unit); tile.Place(Instantiate(unit, tile.transform.position, Quaternion.identity)); } } }
public IActionResult DeleteIdea(int ideaId) { string key = HttpContext.Session.GetString("login"); if (!string.IsNullOrEmpty(key)) { Idea idea = resource.GetIdeaData(ideaId); resource.Remove(idea); return(RedirectToAction("BrightIdeas")); } else { return(Content("Access Denied")); } }
private void Collect() { if (audioElement != null) { audioElement.Play(harvestSound); } float collect = collectionAmount * Time.deltaTime; //make sure that the harvester cannot collect more than it can carry if (currentLoad + collect > capacity) { collect = capacity - currentLoad; } resourceDeposit.Remove(collect); currentLoad += collect; }
private void Collect() { if (audioElement != null && Time.timeScale > 0) { audioElement.Play(harvestSound); } float collect = collectionAmount * Time.deltaTime; //make sure that the harvester cannot collect more than it can carry if (currentLoad + collect > capacity) { collect = capacity - currentLoad; } if (resourceDeposit.isEmpty()) { EnableArms(false); DecideWhatToDo(); } else { resourceDeposit.Remove(collect); } currentLoad += collect; }