Exemplo n.º 1
0
        public IEnumerable <Act.Status> PutResources()
        {
            if (BuildRoom.MeetsBuildRequirements())
            {
                yield return(Act.Status.Success);
            }

            if (BuildRoom.ResourcesReservedFor == Agent)
            {
                Agent.Creature.Inventory.Remove(Resources, Inventory.RestockType.None);
                BuildRoom.AddResources(Resources);
                BuildRoom.ResourcesReservedFor = null;
            }
            yield return(Act.Status.Success);
        }
Exemplo n.º 2
0
        public IEnumerable <Act.Status> PutResources()
        {
            if (BuildRoom.MeetsBuildRequirements())
            {
                yield return(Act.Status.Success);
            }

            if (BuildRoom.ResourcesReservedFor == Agent)
            {
                var resources = Agent.Blackboard.GetData <List <Resource> >("zone_resources");
                Agent.Creature.Inventory.Remove(resources, Inventory.RestockType.None);
                BuildRoom.AddResources(resources);
                BuildRoom.ResourcesReservedFor = null;
            }

            yield return(Act.Status.Success);
        }
Exemplo n.º 3
0
        public IEnumerable <Status> WaitForResources()
        {
            if (BuildRoom.ResourcesReservedFor == Agent)
            {
                yield return(Act.Status.Success);

                yield break;
            }

            while (!BuildRoom.MeetsBuildRequirements())
            {
                if (BuildRoom.ResourcesReservedFor == null || BuildRoom.ResourcesReservedFor.IsDead)
                {
                    Agent.SetMessage("Failed to wait for resources.");
                    yield return(Act.Status.Fail);

                    yield break;
                }
                yield return(Act.Status.Running);
            }

            yield return(Act.Status.Success);
        }
Exemplo n.º 4
0
 private bool ValidResourceState()
 {
     return(BuildRoom.MeetsBuildRequirements() || (BuildRoom.ResourcesReservedFor != null));
 }