public override bool perform(GameObject agent) { if (startTime == 0) { enableBubbleIcon(agent); startTime = Time.time; } if (targetTree.wood <= 0) { disableBubbleIcon(agent); targetTree.turnEmptySprite(); return(false); } if (Time.time - startTime > duration) { disableBubbleIcon(agent); Woodcutter woodcutter = (Woodcutter)agent.GetComponent(typeof(Woodcutter)); woodcutter.energy -= energyCost; analyzed = true; if (targetTree.age < 3) { targetTree.viewed = true; return(false); } else { woodcutter.actualTree = targetTree; } } return(true); }
public override bool perform(GameObject agent) { if (startTime == 0) { Woodcutter woodcutter = (Woodcutter)agent.GetComponent(typeof(Woodcutter)); woodcutter.cutting = true; startTime = Time.time; } if (Time.time - startTime > cuttingDuration) { // finished cutting Woodcutter woodcutter = (Woodcutter)agent.GetComponent(typeof(Woodcutter)); targetTree.clipped = true; int wood = 20; if ((targetTree.wood - wood) >= 0) { woodcutter.wood += 20; targetTree.wood -= 20; } else { woodcutter.wood += targetTree.wood; targetTree.wood = 0; } woodcutter.cutting = false; woodcutter.energy -= 51; cutted = true; } return(true); }
private void PlayerWork() { World.Instance.ProgressTime(new TimeSpan(8, 0, 0)); Skill s = player.GetTree("Woodcutter") as Skill; int payment = GetPayment(s); string text = $"You have finished working for the logger and been payed {payment} coins."; if (s is null) { s = new Woodcutter(); player.trees.Add(s); s.Activate(); text += " You have also gained the woodcutter skill."; } else { s.Xp += 1; text += " You have gained 1 Xp in the woodcutter skill."; } player.Money.RawValue += payment; player.playerView.Render(); ProduceItem("Wood", 2); cityV.worldView.controller.Stop(); text += " Do you want to continue working for the logger?"; if (MessageBox.Show(text, "Logger", MessageBoxButtons.YesNo) == DialogResult.Yes) { PlayerWork(); } }
public override bool perform(GameObject agent) { if (startTime == 0) { enableBubbleIcon(agent); startTime = Time.time; } // Tree empty if (targetTree.wood <= 0) { disableBubbleIcon(agent); Woodcutter woodcutter = (Woodcutter)agent.GetComponent(typeof(Woodcutter)); targetTree.turnEmptySprite(); woodcutter.actualTree = null; return(false); } if (Time.time - startTime > duration) { disableBubbleIcon(agent); Woodcutter woodcutter = (Woodcutter)agent.GetComponent(typeof(Woodcutter)); targetTree.chopped = true; targetTree.turnChoppedSprite(); woodcutter.energy -= energyCost; chopped = true; } return(true); }
public void Creation() { using (Woodcutter Temp = new Woodcutter(new ILogger[] { new DefaultLogger() })) { Assert.NotNull(Temp); } new DirectoryInfo("~/Logs/").Delete(); }
void OnMouseDown() { switch (player.currentlySelected) { case PlayerScript.TowerType.Nothing: break; case PlayerScript.TowerType.Lumberjack: if (player.CurrentLumber >= 1) //TODO: Add cost of lumberjack { player.CurrentLumber -= 1; //SendMessage("Not enough lumber"); GameObject lumberjack = Instantiate(TimerjackTower, transform.position, Quaternion.identity) as GameObject; Woodcutter woodcutterScript = lumberjack.GetComponent <Woodcutter>(); woodcutterScript.TreeList = gameObject.transform.parent.gameObject; woodcutterScript.player = player; lumberjack.transform.SetParent(transform.parent.parent); Destroy(gameObject); } break; case PlayerScript.TowerType.BananaTower: if (player.CurrentLumber >= 3) //TODO: Add cost of bananaman { player.CurrentLumber -= 3; //SendMessage("Not enough lumber"); Vector3 spawnPosition = transform.position; spawnPosition.y += BananaTower.transform.position.y; GameObject banana = Instantiate(BananaTower, spawnPosition, Quaternion.identity) as GameObject; CreateArrows bananaTowerScript = banana.GetComponent <CreateArrows>(); bananaTowerScript.enemyList = gameObject.transform.parent.parent.FindChild("EnemyList").gameObject; bananaTowerScript.player = player; banana.transform.SetParent(transform.parent.parent); Destroy(gameObject); } break; case PlayerScript.TowerType.ClusterTower: if (player.CurrentLumber >= 5) //TODO: Add cost of bananaman { player.CurrentLumber -= 5; //SendMessage("Not enough lumber"); Vector3 spawnPosition = transform.position; spawnPosition.y += ClusterTower.transform.position.y; GameObject clusterBanana = Instantiate(ClusterTower, spawnPosition, Quaternion.identity) as GameObject; CreateCluster bananaTowerScript = clusterBanana.GetComponent <CreateCluster>(); bananaTowerScript.enemyList = gameObject.transform.parent.parent.FindChild("EnemyList").gameObject; bananaTowerScript.player = player; clusterBanana.transform.SetParent(transform.parent.parent); Destroy(gameObject); } break; } }
internal override int CalculateProductionChanges(Building newNeighbour, Tile neighbourTile) { if (newNeighbour is Woodcutter) { Woodcutter woodcutter = newNeighbour as Woodcutter; return(woodcutter.CalculateProduction(neighbourTile)); } return(0); }
public override bool checkProceduralPrecondition(GameObject agent) { Woodcutter woodcutter = (Woodcutter)agent.GetComponent(typeof(Woodcutter)); // Go to warehouse target = woodcutter.warehouse.gameObject; // Debug.DrawLine(target.transform.position, agent.transform.position, Color.yellow, 3, false); return(target != null); }
public override bool checkProceduralPrecondition(GameObject agent) { Woodcutter woodcutter = (Woodcutter)agent.GetComponent(typeof(Woodcutter)); targetTree = woodcutter.actualTree; if (targetTree != null) { target = targetTree.gameObject; } return(targetTree != null); }
public void Log() { using (Woodcutter Temp = new Woodcutter(new ILogger[] { new DefaultLogger() })) { var File = (DefaultLog)Temp.GetLog(); Assert.Equal("Default", File.Name); foreach (MessageType Type in Enum.GetValues(typeof(MessageType))) { File.LogMessage("TestMessage", Type); } Assert.Contains("\r\nGeneral: TestMessage\r\nDebug: TestMessage\r\nTrace: TestMessage\r\nInfo: TestMessage\r\nWarn: TestMessage\r\nError: TestMessage\r\n", new FileInfo(File.FileName).Read()); } new DirectoryInfo("~/Logs/").Delete(); }
public bool Consort(Woodcutter slayer) { bool isSlayer = false; _mutex.WaitOne(); // FCFS if (Slayer == null) { Slayer = slayer; isSlayer = true; } _mutex.Release(); return(isSlayer); }
public static List <Pile> TheFirstGame(bool two) { return(new List <Pile> { new Pile(Cellar.Get(), 10), new Pile(Moat.Get(), 10), new Pile(Village.Get(), 10), new Pile(Woodcutter.Get(), 10), new Pile(Workshop.Get(), 10), new Pile(Militia.Get(), 10), new Pile(Remodel.Get(), 10), new Pile(Smithy.Get(), 10), new Pile(Market.Get(), 10), new Pile(Mine.Get(), 10), }.Concat(VictoryAndTreasures(two)).ToList()); }
public override int CalculateProduction(Tile tile) { List <Tile> tilesInRange = tile.GetAllTilesAround(collectionRange); int collectedFunds = baseProduction; foreach (var tempTile in tilesInRange) { if (tempTile.placedBuilding != null && tempTile.placedBuilding is Woodcutter) { Woodcutter woodcutter = tempTile.placedBuilding as Woodcutter; collectedFunds += woodcutter.CalculateProduction(); } } return(collectedFunds); }
public override bool perform(GameObject agent) { if (startTime == 0) { Woodcutter woodcutter = (Woodcutter)agent.GetComponent(typeof(Woodcutter)); woodcutter.recovering = true; startTime = Time.time; } if (Time.time - startTime > recoveringDuration) { Woodcutter woodcutter = (Woodcutter)agent.GetComponent(typeof(Woodcutter)); woodcutter.energy = 100; woodcutter.recovering = false; recovered = true; } return(true); }
public override bool perform(GameObject agent) { if (startTime == 0) { Woodcutter woodcutter = (Woodcutter)agent.GetComponent(typeof(Woodcutter)); woodcutter.keeping = true; startTime = Time.time; } if (Time.time - startTime > dropDuration) { Woodcutter woodcutter = (Woodcutter)agent.GetComponent(typeof(Woodcutter)); targetWarehouse.wood += woodcutter.wood; woodcutter.wood = 0; woodcutter.keeping = false; droppedWood = true; } return(true); }
void Start() { Buildings = new List <Building>(); Well newWell = new Well(WELL_INDEX); Buildings.Add(newWell); wellLevel.text = "Level: " + Buildings[WELL_INDEX].Level.ToString(); cost = Mathf.CeilToInt(newWell.Level * newWell.CostModifier).ToString(); cost = Mathf.CeilToInt(newWell.Level * newWell.CostModifier).ToString(); wellCost.text = "Cost to Build: " + cost + " Wood and " + cost + " Stone"; Farm newFarm = new Farm(FARM_INDEX); Buildings.Add(newFarm); farmLevel.text = "Level: " + Buildings[FARM_INDEX].Level.ToString(); cost = Mathf.CeilToInt(newFarm.Level * newFarm.CostModifier).ToString(); farmCost.text = "Cost to Build: " + cost + " Wood and " + cost + " Stone"; Woodcutter newWoodcutter = new Woodcutter(WOODCUTTER_INDEX); Buildings.Add(newWoodcutter); woodcutterLevel.text = "Level: " + Buildings[WOODCUTTER_INDEX].Level.ToString(); cost = Mathf.CeilToInt(newWoodcutter.Level * newWell.CostModifier).ToString(); woodcutterCost.text = "Cost to Build: " + cost + " Wood and " + cost + " Stone"; Stonemason newStonemason = new Stonemason(STONEMASON_INDEX); Buildings.Add(newStonemason); stonemasonLevel.text = "Level: " + Buildings[STONEMASON_INDEX].Level.ToString(); cost = Mathf.CeilToInt(newStonemason.Level * newStonemason.CostModifier).ToString(); stonemasonCost.text = "Cost to Build: " + cost + " Wood and " + cost + " Stone"; House newHouse = new House(HOUSE_INDEX); Buildings.Add(newHouse); houseLevel.text = "Level: " + Buildings[HOUSE_INDEX].Level.ToString(); cost = Mathf.CeilToInt(newHouse.Level * newHouse.CostModifier).ToString(); houseCost.text = "Cost to Build: " + cost + " Wood and " + cost + " Stone"; }
public override bool perform(GameObject agent) { if (startTime == 0) { enableBubbleIcon(agent); startTime = Time.time; } if (Time.time - startTime > duration) { disableBubbleIcon(agent); Woodcutter woodcutter = (Woodcutter)agent.GetComponent(typeof(Woodcutter)); if (targetTree != null && targetTree.gameObject != null) { Destroy(targetTree.gameObject); } woodcutter.wood += 20; woodcutter.energy -= energyCost; removed = true; } return(true); }
public override bool perform(GameObject agent) { if (startTime == 0) { enableBubbleIcon(agent); startTime = Time.time; } if (Time.time - startTime > duration) { disableBubbleIcon(agent); Woodcutter woodcutter = (Woodcutter)agent.GetComponent(typeof(Woodcutter)); // Drop in warehouse woodcutter.warehouse.wood += woodcutter.wood; SawmillBuilding[] sawmills = (SawmillBuilding[])FindObjectsOfType(typeof(SawmillBuilding)); foreach (SawmillBuilding saw in sawmills) { if (!saw.blueprint.done) { continue; } woodcutter.sawmill = saw; woodcutter.sawmill.workers++; break; } if (woodcutter.sawmill == null) { // Add request sawmill Building building = new Building("Prefabs/Buildings/Sawmill", 200, 150, 5, 2); woodcutter.center.addNewBuildingRequest(building); } woodcutter.wood = 0; droppedWood = true; } return(true); }
public override bool perform(GameObject agent) { if (startTime == 0) { enableBubbleIcon(agent); startTime = Time.time; } // Tree empty if (targetTree.wood <= 0) { disableBubbleIcon(agent); Woodcutter woodcutter = (Woodcutter)agent.GetComponent(typeof(Woodcutter)); targetTree.turnEmptySprite(); woodcutter.actualTree = null; return(false); } if (Time.time - startTime > duration) { disableBubbleIcon(agent); Woodcutter woodcutter = (Woodcutter)agent.GetComponent(typeof(Woodcutter)); // Finished cutting int wood = 30; if ((targetTree.wood - wood) >= 0) { woodcutter.wood += wood; targetTree.wood -= wood; } else { woodcutter.wood += targetTree.wood; targetTree.wood = 0; } woodcutter.energy -= energyCost; clipped = true; } return(true); }
public override bool perform(GameObject agent) { if (startTime == 0) { enableBubbleIcon(agent); startTime = Time.time; } if (Time.time - startTime > duration) { disableBubbleIcon(agent); Woodcutter woodcutter = (Woodcutter)agent.GetComponent(typeof(Woodcutter)); if (woodcutter.sawmill != null) { // Drop in sawmill woodcutter.sawmill.wood += woodcutter.wood; } woodcutter.wood = 0; droppedWood = true; } return(true); }
// BASE static PresetGames() { games.Add(Games.AllCards1stEdition, new List <Card> { Adventurer.Get(), Bureaucrat.Get(), Cellar.Get(), CouncilRoom.Get(), Feast.Get(), Festival.Get(), Gardens.Get(), Chancellor.Get(), Chapel.Get(), Laboratory.Get(), Library.Get(), Market.Get(), Militia.Get(), Mine.Get(), Moat.Get(), Moneylender.Get(), Remodel.Get(), Smithy.Get(), Spy.Get(), Thief.Get(), ThroneRoom.Get(), Village.Get(), Witch.Get(), Woodcutter.Get(), Workshop.Get(), }); games.Add(Games.FirstGame, new List <Card> { Cellar.Get(), Moat.Get(), Village.Get(), Woodcutter.Get(), Workshop.Get(), Militia.Get(), Remodel.Get(), Smithy.Get(), Market.Get(), Mine.Get(), }); games.Add(Games.BigMoney, new List <Card> { Adventurer.Get(), Bureaucrat.Get(), Chancellor.Get(), Chapel.Get(), Feast.Get(), Laboratory.Get(), Market.Get(), Mine.Get(), Moneylender.Get(), ThroneRoom.Get(), }); games.Add(Games.Interaction, new List <Card> { Bureaucrat.Get(), Chancellor.Get(), CouncilRoom.Get(), Festival.Get(), Library.Get(), Militia.Get(), Moat.Get(), Spy.Get(), Thief.Get(), Village.Get() }); games.Add(Games.SizeDistortion, new List <Card> { Cellar.Get(), Chapel.Get(), Feast.Get(), Gardens.Get(), Laboratory.Get(), Thief.Get(), Village.Get(), Witch.Get(), Woodcutter.Get(), Workshop.Get(), }); games.Add(Games.VillageSquare, new List <Card> { Bureaucrat.Get(), Cellar.Get(), Festival.Get(), Library.Get(), Market.Get(), Remodel.Get(), Smithy.Get(), ThroneRoom.Get(), Village.Get(), Woodcutter.Get(), }); games.Add(Games.ThrashHeap, new List <Card> { Chapel.Get(), Village.Get(), Workshop.Get(), Woodcutter.Get(), Feast.Get(), Moneylender.Get(), Remodel.Get(), Mine.Get(), Festival.Get(), Market.Get(), }); }
/// <summary> /// Creates a new card based on how many cards have already been made. /// </summary> /// <param name="card"> /// The name of the card to be created. /// </param> /// <returns> /// The new created card. /// </returns> public static Card CreateCard(CardName card) { Contract.Requires(card != CardName.Backside & card != CardName.Empty); Contract.Ensures(Contract.Result<Card>().Name == card); Card c; switch (card) { case CardName.Copper: c = new Copper(); break; case CardName.Silver: c = new Silver(); break; case CardName.Gold: c = new Gold(); break; case CardName.Curse: c = new Curse(); break; case CardName.Estate: c = new Estate(); break; case CardName.Duchy: c = new Duchy(); break; case CardName.Province: c = new Province(); break; case CardName.Gardens: c = new Gardens(); break; case CardName.Cellar: c = new Cellar(); break; case CardName.Chapel: c = new Chapel(); break; case CardName.Chancellor: c = new Chancellor(); break; case CardName.Village: c = new Village(); break; case CardName.Woodcutter: c = new Woodcutter(); break; case CardName.Workshop: c = new Workshop(); break; case CardName.Feast: c = new Feast(); break; case CardName.Moneylender: c = new Moneylender(); break; case CardName.Remodel: c = new Remodel(); break; case CardName.Smithy: c = new Smithy(); break; case CardName.ThroneRoom: c = new ThroneRoom(); break; case CardName.CouncilRoom: c = new CouncilRoom(); break; case CardName.Festival: c = new Festival(); break; case CardName.Laboratory: c = new Laboratory(); break; case CardName.Library: c = new Library(); break; case CardName.Market: c = new Market(); break; case CardName.Mine: c = new Mine(); break; case CardName.Adventurer: c = new Adventurer(); break; case CardName.Bureaucrat: c = new Bureaucrat(); break; case CardName.Militia: c = new Militia(); break; case CardName.Spy: c = new Spy(); break; case CardName.Thief: c = new Thief(); break; case CardName.Witch: c = new Witch(); break; case CardName.Moat: c = new Moat(); break; default: throw new NotImplementedException("Tried to create a card that was not implemented when CardFactory was last updated."); } c.Initialize(card, CardsMade[card]); CardsMade[card] += 1; createdCards.Add(c, true); return c; }
internal override void ShowCard(string s,int x,int y) { PlayCard a = new PlayCard(); switch (s) { case "銅貨": a = new Cooper(ShowField, ShowHand, this); break; case "銀貨": a = new Silver(ShowField, ShowHand, this); break; case "金貨": a = new Gold(ShowField, ShowHand, this); break; case "屋敷": a = new Mansion(ShowField, ShowHand, this); break; case "公領": a = new Landtag(ShowField, ShowHand, this); break; case "属州": a = new Province(ShowField, ShowHand, this); break; case "地下貯蔵庫": a = new UndergroundRepository(ShowField, ShowHand, this); break; case "市場": a = new Market(this); break; case "民兵": a = new Militia(ShowField, ShowHand, this); break; case "鉱山": a = new Mine(ShowField, ShowHand, this); break; case "堀": a = new Moat(this); break; case "鍛冶屋": a = new Smithy(this); break; case "村": a = new Village(this); break; case "木こり": a = new Woodcutter(this); break; case "改築": a = new Remodel(this); break; case "工房": a = new Workshop(this); break; } a.Location = new System.Drawing.Point(x,y); a.Size = new System.Drawing.Size(70, 110); a.Name = s; a.SizeMode = PictureBoxSizeMode.StretchImage; a.Image = global::dominion.Properties.Resources.back; form1.Controls.Add(a); a.BringToFront(); ShowHand.Add(a); a.ChangePointPara(880 + 20 * ShowHand.Count, 10 + 120 * num); for (int i = 0; i < ShowHand.Count; i++) { ShowHand[i].Refresh(); } ShowDeck.Refresh(); }