Example #1
0
        public override bool ShouldRunState(AgentController owner, out StateConfig config)
        {
            if (!owner.IsInState <MineCurrencyState>(false))
            {
                var       thing     = App.AIBlackboard.GetAvailableMinePoints();
                Inventory minePoint = thing.Find(inventory => Vector3.Distance(inventory.transform.position, owner.transform.position) < DistanceThreshold(owner));
                if (minePoint != null)
                {
                    config = new MineCurrencyConfig(owner, minePoint);
                    return(true);
                }
            }

            config = null;
            return(false);
        }
Example #2
0
        public override bool ShouldRunState(AgentController owner, out StateConfig config)
        {
            if (!owner.IsInState <StealState>(false) && owner.GetAbsoluteDesireValue(DesireType.Money) > _moneyDesireThreshold)
            {
                Inventory[] inventories = GameObject.FindObjectsOfType <Inventory>();
                Inventory   toSteal     = inventories.FirstOrDefault(inventory => inventory.OnGround && inventory.Owner != owner && IsInventoryUnattended(inventory, owner));
                if (toSteal != null)
                {
                    config = new StealConfig(toSteal, owner);
                    return(true);
                }
            }

            config = null;
            return(false);
        }