public void CollectGatherable(IGatherable g) { if (ToGatherItemsList.Contains(g)) { Points += g.PointsWorth; ToGatherItemsList.Remove(g); } }
private void AssignToCollectItemsToPlayers() { foreach (PlayElement playerElement in PlayElements["Players"]) { Player player = (Player)playerElement; foreach (PlayElement gatherableElement in PlayElements["Gatherables"]) { IGatherable gatherable = (IGatherable)gatherableElement; player.AddToCollectGatherable(gatherable); gatherable.AddPlayers(player); } } }
public bool StartGathering(IGatherable target, Action <IGatherable> completionCallback) { var success = target.AddGatherer(this); if (!success) { return(false); } state = States.Gathering; gatherPercent = 0f; gatherable = target; gatheringCompletedCallback = completionCallback; return(true); }
public void addMaterial(GameObject input) { IGatherable other = input.GetComponent <IGatherable>(); Debug.Log("Harvesting: " + input.tag); switch (input.tag) { case "Tree": other.harvest(); inventory.getWood().addMaterial(other.getWood()); inventory.getBark().addMaterial(other.getBark()); increaseXp(other.getXp()); break; case "Stone": other.harvest(); inventory.getStone().addMaterial(other.getStone()); increaseXp(other.getXp()); break; case "Boulder": other.harvest(); inventory.getStone().addMaterial(other.getStone()); increaseXp(other.getXp()); break; case "Bush": other.harvest(); inventory.getFiber().addMaterial(other.getFiber()); increaseXp(other.getXp()); break; default: break; } //inventory.printMaterials(); }
public void AddToCollectGatherable(IGatherable g) { ToGatherItemsList.Add(g); }
private void OnGatherComplete(IGatherable g) { Agent.Memory.Set(AIAttributes.HeldItem, gatherer.HeldItem); StateComplete(); }
public void SetTarget(IGatherable target) { gatherable = target; }