private GatherBot CreateBot(int dockID, bool ignoreCost = false) { if (!ignoreCost) { if (resourceCount < botCreationCost + minLeftoverResources) { return(null); } resourceCount -= botCreationCost; toBeSpent -= botCreationCost; inventory.RemoveItem(Item.Type.PureCorvorite, botCreationCost); } GatherBot bot = Instantiate(botPrefab); bot.Create(this, botBaseHP, dockID); bot.Activate(false); occupiedDocks[dockID] = true; bot.transform.position = docks[dockID].position; bot.transform.rotation = docks[dockID].rotation; bot.transform.parent = transform.parent; childBots.Add(bot); AssignUnoccupiedCoords(bot); BuildBot(dockID); return(bot); }
public void Store(List <ItemStack> items, GatherBot b) { b.Activate(false); dockAnims[b.dockID].SetTrigger("Dismantle1"); inventory.Store(items); resourceCount = inventory.Count(Item.Type.PureCorvorite); SpendResources(b); }
public void ActivateBot(int ID, Vector2 position) { for (int i = 0; i < childBots.Count; i++) { GatherBot bot = childBots[i]; if (bot.dockID == ID) { bot.transform.position = position; bot.Activate(true); return; } } }