Пример #1
0
        public Tuple<Activity, Behaviour> CollectWood(WorldView state)
        {
            if (state.Location != home && state.CanCollect<Wood>() > 0)
              {
            lastWoodSource = state.Location;
            return Do.Collect<Wood>().Then(ReturnHome);
              }

              if (state.CanHarvest<Wood>() > 0)
              {
            return Do.Harvest<Wood>().Then(CollectWood);
              }

              if (lastWoodSource != null && lastWoodSource != state.Location)
              {
            return Move.Towards(lastWoodSource).Then(CollectWood);
              }

              lastWoodSource = null;
              return FindWood(state);
        }