public void GatherRessources(RessourceType ressource) { if (ressource == RessourceType.Fish) { FoodStorage.IncreaseFoodBy(1); } }
private void HandleCosts(RessourceCosts costs, float tokens) { if (tokens > 0) { Wood.DecreaseWoodBy(costs.AmountOfWood); Fur.DecreaseBy(costs.AmountOfLeather); if (FoodStorage.Food < costs.AmountOfFood) { int foodCost = costs.AmountOfFood - FoodStorage.Food; foodUsed = FoodStorage.Food; FoodStorage.DecreaseFoodBy(FoodStorage.Food); permanentFoodUsed = foodCost; FoodStorage.DecreasePermantFoodBy(foodCost); } else { foodUsed = costs.AmountOfFood; FoodStorage.DecreaseFoodBy(foodUsed); } } else if (tokens == 0) { Wood.IncreaseWoodBy(costs.AmountOfWood); Fur.IncreaseBy(costs.AmountOfLeather); FoodStorage.IncreaseFoodBy(foodUsed); FoodStorage.IncreasePermantFoodBy(permanentFoodUsed); } }
private void TaskOnClick() { PartyActions.Sleep(); if (Tent.Status == TentStatus.Fireplace) { PartyActions.DamageAllPlayers(1); } if (InventionStorage.IsAvailable(Invention.Cellar)) { var food = FoodStorage.Food; FoodStorage.DecreaseFoodBy(food); FoodStorage.IncreasePermantFoodBy(food); } if (CampMoved) { Wall.HalfValue_Ceiling(); Roof.HalfValue_Ceiling(); } FoodStorage.DiscardFood(); Destroy(popUp); var phaseView = FindObjectOfType <PhaseView>(); phaseView.NextPhase(); RoundSystem.instance.increaseRound(); }
public FishTask(Fish actor, Transform targetObject, FishTaskType type, FoodStorage storage = null) { this.actor = actor; this.targetObject = targetObject; this.storage = storage; this.type = type; inRadiusOffset = Random.onUnitSphere; }
private void ExecuteFutureThreat() { Wood.DiscardAll(); FoodStorage.DiscardAll(); Fur.DiscardAll(); //TODO: skip production phase during this turn }
// Food storages management public static void BuyFoodStorge(FoodStorage foodStorage) { if (foodStorage == null) { throw new NullReferenceException("There is no food storage provided!"); } foodStoragesDB.Add(foodStorage); BudgetInfo.AddExpense(foodStorage.Type.ToString(), foodStorage.Price); }
public override void UseAbility() { if (CurrentDetermination >= GetAbilityCosts()) { //Stone Soup CharacterActions.LowerCharacterDeterminationBy(GetAbilityCosts(), this); FoodStorage.IncreaseFoodBy(1); } }
public MainWindow() { foodStorage = new FoodStorage(); mainViewModel = new MainViewModel { Food = new Food(), Foods = foodStorage.Foods }; InitializeComponent(); DataContext = mainViewModel; }
public void GatherRessources(RessourceType ressource) { if (ressource == RessourceType.Wood) { Wood.IncreaseWoodBy(1); } else if (ressource == RessourceType.Parrot) { FoodStorage.IncreaseFoodBy(1); } }
public static void DiscardFoodStorage(long storageID) { try { FoodStorage storageToBeDiscarded = foodStoragesDB.Find(x => x.StorageID == storageID); foodStoragesDB.Remove(storageToBeDiscarded); } catch (Exception) { throw new UnitNotFoundException("There is no food storage with such ID!"); } }
// Start is called before the first frame update void Start() { //TODO: Initialize all the other stuff Roof.SetStartValue(0); Wall.SetStartState(0); WeaponPower.SetStartValue(0); Fur.SetStartValue(0); Wood.SetStartValue(0); FoodStorage.SetStartValue(0, 0); Moral.SetStartValue(); TerrainStorage.CreateStorageSpace(); InventionStorage.CreateStorageSpace(); }
private void ExecuteFutureThreat() { if (FoodStorage.GetTotal() < 1) { var active = Player.PartyActions.ExecutingCharacter; Characters.CharacterActions.DamageCharacterBy(1, active); } else { FoodStorage.Consume(1); } WeaponPower.RaiseWeaponPowerBy(1); }
// Load DB from files private static void LoadData() { string[] fileEntries = Directory.GetFiles(FolderName); string[] fileData; string[] objectData; Object[] args = new Object[20]; foreach (string fullFileName in fileEntries) { fileData = File.ReadAllLines(fullFileName); string dbName = System.IO.Path.GetFileName(fullFileName).Replace(".txt", ""); foreach (var record in fileData) { objectData = record.Split('#'); for (int i = 1; i < objectData.Length; i++) { args[i - 1] = objectData[i]; } switch (dbName) { case "animals": Animal animal = (Animal)Activator.CreateInstance(Type.GetType(objectData[0]), args); AcquireAnimal(animal); break; case "budget": BudgetInfo = (Budget)Activator.CreateInstance(Type.GetType(objectData[0]), args); break; case "cages": Cage cage = (Cage)Activator.CreateInstance(Type.GetType(objectData[0]), args); cagesDB.Add(cage); break; case "employees": Employee employee = (Employee)Activator.CreateInstance(Type.GetType(objectData[0]), args); staffDB.Add(employee); break; case "food": FoodStorage food = (FoodStorage)Activator.CreateInstance(Type.GetType(objectData[0]), args); foodStoragesDB.Add(food); break; default: break; } } } }
static void Main(string[] args) { //Problem 5 Border Control //BorderControl border = new BorderControl(); //border.Run(); //Problem 6. Birthday Celebrations //BirthdayCelebration birthday = new BirthdayCelebration(); //birthday.Run(); //Problem 7. Food Shortage FoodStorage foodStorage = new FoodStorage(); foodStorage.Run(); }
private bool CheckBuildCosts() { var costs = GetComponent <ItemCard>().cardClass.GetRessourceCosts(); bool retVal = true; if (Wood.currentAmountOfWood < costs.AmountOfWood) { retVal = false; } if (Fur.currentAmountOfFur < costs.AmountOfLeather) { retVal = false; } if (FoodStorage.GetTotal() < costs.AmountOfFood) { retVal = false; } return(retVal); }
public static void Sleep() { foreach (Character c in PartyHandler.PartySession) { if (c is ISideCharacter) { continue; } if (FoodStorage.GetTotal() >= 1) { FoodStorage.Consume(1); } else { CharacterActions.DamageCharacterBy(2, c); } } }
private bool CheckBuildCosts() { var costs = BuildingCosts.GetBuildingCosts(); bool retVal = true; if (Wood.currentAmountOfWood < costs.AmountOfWood) { retVal = false; } if (Fur.currentAmountOfFur < costs.AmountOfLeather) { retVal = false; } if (FoodStorage.GetTotal() < costs.AmountOfFood) { retVal = false; } return(retVal); }
private bool CheckBuildCosts(IEventCard card) { var costs = card.GetRessourceCosts(); bool retVal = true; if (Wood.currentAmountOfWood < costs.AmountOfWood) { retVal = false; } if (Fur.currentAmountOfFur < costs.AmountOfLeather) { retVal = false; } if (FoodStorage.GetTotal() < costs.AmountOfFood) { retVal = false; } return(retVal); }
private List <Team> ParseTeams(JObject config) { var file = config.Value <string>("unitConfig"); UnitConfig = JObject.Parse(File.ReadAllText(file)); var teams = new List <Team>(); var teamsConfig = config.Value <JArray>("teams"); var i = 0; foreach (JObject teamConfig in teamsConfig) { FoodStorage storage = null; if (teamConfig.ContainsKey("storage")) { var storageConfig = teamConfig.Value <JObject>("storage"); var location = storageConfig.ToObject <Location>().ToPoint(); var limit = storageConfig.Value <int>("limit"); storage = new FoodStorage(limit, location); } var home = storage?.Location ?? new Point(-1, -1); var units = new List <Unit>(); string path = teamConfig.Value <string>("units"); var teamFile = JObject.Parse(File.ReadAllText(path)); var unitsList = teamFile.Value <JArray>("units"); foreach (JObject unit in unitsList) { units.AddRange(ParseUnits(unit, home)); } var team = (storage != null) ? new Team(i, units, storage) : new Team(i, units); teams.Add(team); i++; } return(teams); }
private void HandleRessourceCosts() { Debug.Log("Wood " + amountWoodGone); Debug.Log("Food " + amountFoodGone); if (amountWoodGone > 0) { Wood.DecreaseWoodBy(amountWoodGone); } if (amountFoodGone > 0) { if (FoodStorage.GetTotal() < amountFoodGone) { int difference = amountFoodGone - FoodStorage.GetTotal(); FoodStorage.Consume(FoodStorage.GetTotal()); PartyActions.DamageAllPlayers(difference); } else { FoodStorage.Consume(amountFoodGone); } } }
private void OnMouseDown() { var component = GetComponent <Actionphase_CanClick>(); if (component != null && component.IsClickable) { if (Charges == 0) { return; } FoodStorage.IncreaseFoodBy(1); Charges--; if (Charges == 1) { token_1.SetActive(true); } if (Charges == 0) { token_2.SetActive(true); } } }
private void ExecuteActiveThreat() { var numberOfPlayers = Player.PartyActions.GetNumberOfPlayers(); FoodStorage.IncreaseFoodBy(numberOfPlayers); }
public IEnumerator storeFood() { if (toCarry.GetType().IsSubclassOf(typeof(Foods))) { //Debug.Log("Storing food"); FoodStorage sRoom = null; NavNode target = null; for (int i = 0; i < NavGraph.rooms.Count; i++) { if (NavGraph.rooms[i].specialization == null) { continue; } if (NavGraph.rooms[i].specialization.GetType() == typeof(FoodStorage)) { NavNode spot = ((FoodStorage)NavGraph.rooms[i].specialization).demandFreeSpot(); Debug.Log("spot " + spot); if (spot != null) { sRoom = (FoodStorage)NavGraph.rooms[i].specialization; target = spot; // Debug.Log("targeting"); } } } if (target == null) { //Debug.Log("No Target"); lookForJob = true; World.w.workers.Add(this); yield break; } Debug.Log("moving " + toCarry + " to " + target.position); path = PathFind.getPath(World.w.GetBlockNegCoor(position).navNode, target); startWalking(); while (Vector2.Distance(position, target.position) > .2f) { yield return(null); } sRoom.addFood(new StorageElement((Foods)toCarry, target.position)); } else { //Debug.Log("Storing item"); ResourcesStorage sRoom = null; NavNode target = null; for (int i = 0; i < NavGraph.rooms.Count; i++) { if (NavGraph.rooms[i].specialization == null) { continue; } if (NavGraph.rooms[i].specialization.GetType() == typeof(ResourcesStorage)) { NavNode spot = ((ResourcesStorage)NavGraph.rooms[i].specialization).demandFreeSpot(); if (spot != null) { sRoom = (ResourcesStorage)NavGraph.rooms[i].specialization; target = spot; } } } if (target == null) { lookForJob = true; World.w.workers.Add(this); yield break; } Debug.Log("moving " + toCarry + " to " + target.position); path = PathFind.getPath(World.w.GetBlock(position).navNode, target); startWalking(); while (Vector2.Distance(position, target.position) > .2f) { yield return(null); } sRoom.addResource(new ResourcesElement((Resource)toCarry, target.position)); } lookForJob = true; World.w.workers.Add(this); toCarry = null; anime.SetInteger("toCarryID", 0); anime.SetInteger("Direction", anime.GetInteger("Direction") - 4); yield return(null); }
private void Awake() { money = FindObjectOfType <MoneyCollector>(); medicine = FindObjectOfType <MedicalCenter>(); food = FindObjectOfType <FoodStorage>(); }
public void ExecuteSuccessEvent() { //TODO: Card has an option for only one action point FoodStorage.IncreaseFoodBy(1); FoodStorage.IncreasePermantFoodBy(1); }
public void Research() { FoodStorage.IncreasePermantFoodBy(2); }
private void ExecuteActiveThreat() { FoodStorage.IncreaseFoodBy(2); Fur.IncreaseBy(1); }