private NodeState BuyConstruct(ConstructId type) { if (!constructCountQuery.ContainsKey(type)) { constructCountQuery.Add(new QueryItem <ConstructId, float>(type, 0.0f), true); int price = 0; switch (type) { case ConstructId.Barrack: price = ConstructPrice.Barrack; break; case ConstructId.Defender: price = ConstructPrice.Defender; break; case ConstructId.Refinery: price = ConstructPrice.Refinery; break; case ConstructId.Yard: price = ConstructPrice.Yard; break; } npc.TakeGold(-price); } return(NodeState.Success); }
private NodeState BuyAgent(Soldier type) { if (!agentCountQuery.ContainsKey(type)) { if (CheckEnoughGoldToBuyAgent(type) == NodeState.Success) { agentCountQuery.Add(new QueryItem <Soldier, float>(type, 0.0f), false); return(NodeState.Success); } else { return(NodeState.Failure); } } return(NodeState.Success); }