示例#1
0
 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);
         }
     }
 }
示例#3
0
        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);
        }
示例#4
0
    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();
    }
示例#5
0
 public void AddToCollectGatherable(IGatherable g)
 {
     ToGatherItemsList.Add(g);
 }
示例#6
0
 private void OnGatherComplete(IGatherable g)
 {
     Agent.Memory.Set(AIAttributes.HeldItem, gatherer.HeldItem);
     StateComplete();
 }
示例#7
0
 public void SetTarget(IGatherable target)
 {
     gatherable = target;
 }