Esempio n. 1
0
 public override bool CanExecute(WorldModel worldModel)
 {
     /*NOTE: I added the variable BestFlagLocationRecord because
     its easier then iterating through the list to find the location record that matches the BestFlagPosition
     */
     return (float)worldModel.GetProperty(Properties.ENERGY) > 3.0f && Character.CombinedInfluence[Character.BestFlagLocationRecord] >= .4f;
 }
 public override bool CanExecute(WorldModel worldModel)
 {
     if (this.Target == null)
         return false;
     var targetEnabled = worldModel.GetResourceState (this.Target.name);
     return targetEnabled;
 }
 public override bool CanExecute(WorldModel worldModel)
 {
     if (this.Target == null)
         return false;
     var targetEnabled = (bool)worldModel.GetProperty (this.Target.name);
     return targetEnabled;
 }
 public DepthLimitedGOAPDecisionMaking(WorldModel currentStateWorldModel, List<Action> actions, List<Goal> goals)
 {
     this.ActionCombinationsProcessedPerFrame = 200;
     this.Actions = actions;
     this.Goals = goals;
     this.InitialWorldModel = currentStateWorldModel;
 }
Esempio n. 5
0
        public override void ApplyActionEffects(WorldModel worldModel)
        {
            //TODO its probably wrong, needs to be corrected
            base.ApplyActionEffects(worldModel);

            var conquerValue = worldModel.GetGoalValue(AutonomousCharacter.CONQUER_GOAL);
            worldModel.SetGoalValue(AutonomousCharacter.CONQUER_GOAL, conquerValue - 2.0f);

            var duration = this.GetDuration(worldModel);
            var energyChange = duration * 0.01f;
            var hungerChange = duration * 0.1f;

            var restValue = worldModel.GetGoalValue(AutonomousCharacter.REST_GOAL);
            worldModel.SetGoalValue(AutonomousCharacter.REST_GOAL, restValue + energyChange);

            var energy = (float)worldModel.GetProperty(Properties.ENERGY);
            worldModel.SetProperty(Properties.ENERGY, energy - energyChange);

            var eatGoalValue = worldModel.GetGoalValue(AutonomousCharacter.EAT_GOAL);
            worldModel.SetGoalValue(AutonomousCharacter.EAT_GOAL, eatGoalValue + hungerChange);

            var hunger = (float)worldModel.GetProperty(Properties.HUNGER);
            worldModel.SetProperty(Properties.HUNGER, hunger + hungerChange);

            worldModel.SetProperty(Properties.POSITION, this.Character.BestFlagPosition);
        }
Esempio n. 6
0
        public override void ApplyActionEffects(WorldModel worldModel)
        {
            base.ApplyActionEffects(worldModel);

            //disables the target object so that it can't be reused again
            worldModel.SetProperty(this.Target.name, false);
        }
Esempio n. 7
0
        public override bool CanExecute(WorldModel worldModel)
        {
            if (!base.CanExecute(worldModel)) return false;

            var energy = (float) worldModel.GetProperty(Properties.ENERGY);
            return energy < 5.0f;
        }
Esempio n. 8
0
        public override void ApplyActionEffects(WorldModel worldModel)
        {
            base.ApplyActionEffects(worldModel);

            var restValue = worldModel.GetGoalValue(AutonomousCharacter.REST_GOAL);
            worldModel.SetGoalValue(AutonomousCharacter.REST_GOAL,restValue-1.0f);
        }
        public override void ApplyActionEffects(WorldModel worldModel)
        {
            //TODO its probably wrong, needs to be corrected
            base.ApplyActionEffects(worldModel);

            //var position = (Vector3)worldModel.GetProperty(Properties.POSITION);
            var position = this.Character.Character.KinematicData.position;
            var distance = (this.Character.BestFlagPosition - position).magnitude;

            if (distance <= 5.0f)
            {
                var conquerValue = worldModel.GetGoalValue(AutonomousCharacter.CONQUER_GOAL);
                worldModel.SetGoalValue(AutonomousCharacter.CONQUER_GOAL, conquerValue - 2.0f);
            }
            else
            {
                var duration = distance / 20.0f;
                var energyChange = duration * 0.01f;
                var hungerChange = duration * 0.1f;

                var restValue = worldModel.GetGoalValue(AutonomousCharacter.REST_GOAL);
                worldModel.SetGoalValue(AutonomousCharacter.REST_GOAL, restValue + energyChange);

                var energy = (float)worldModel.GetProperty(Properties.ENERGY);
                worldModel.SetProperty(Properties.ENERGY, energy - energyChange);

                var eatGoalValue = worldModel.GetGoalValue(AutonomousCharacter.EAT_GOAL);
                worldModel.SetGoalValue(AutonomousCharacter.EAT_GOAL, eatGoalValue + hungerChange);

                var hunger = (float)worldModel.GetProperty(Properties.HUNGER);
                worldModel.SetProperty(Properties.HUNGER, hunger + hungerChange);
            }

            worldModel.SetProperty(Properties.POSITION, this.Character.BestFlagPosition);
        }
Esempio n. 10
0
        public override void ApplyActionEffects(WorldModel worldModel)
        {
            base.ApplyActionEffects(worldModel);

            // var arrows = (float)worldModel.GetProperty(Properties.ARROWS);
            worldModel.SetProperty(Properties.ARROWS, 10);
        }
Esempio n. 11
0
 public override void ApplyActionEffects(WorldModel worldModel)
 {
     var restValue = worldModel.GetGoalValue(AutonomousCharacter.REST_GOAL);
     worldModel.SetGoalValue(AutonomousCharacter.REST_GOAL, restValue - 0.1f);
     var eat = worldModel.GetGoalValue(AutonomousCharacter.EAT_GOAL);
     worldModel.SetGoalValue(AutonomousCharacter.EAT_GOAL, eat + 0.2f);
 }
Esempio n. 12
0
 public override bool CanExecute(WorldModel worldModel)
 {
     if (!base.CanExecute(worldModel)) return false;
     var arrows = (int)worldModel.GetProperty(Properties.ARROWS);
     if (arrows == 0) return false;
     return Character.FindSecurityValueForResource(Target.transform.position) > 0;
 }
Esempio n. 13
0
 public WorldModel(WorldModel parent)
 {
     this.Properties = new Dictionary<string, object>();
     this.GoalValues = new Dictionary<string, float>();
     this.Actions = parent.Actions;
     this.Parent = parent;
     this.ActionEnumerator = this.Actions.GetEnumerator();
 }
Esempio n. 14
0
 public override bool CanExecute(WorldModel worldModel)
 {
     if (!base.CanExecute(worldModel))
         return false;
     if (this.Character.BestFlagPosition == null)
         return false;
     return true;
 }
Esempio n. 15
0
 public WorldModel(WorldModel parent)
 {
     this.PropertiesArray = new object[6];
     this.ResourcesState = new Dictionary<string, bool>();
     this.GoalValues = new float[5];
     this.Actions = parent.Actions;
     this.Parent = parent;
     this.ActionEnumerator = this.Actions.GetEnumerator();
 }
Esempio n. 16
0
 public override bool CanExecute(WorldModel worldModel)
 {
     if (!base.CanExecute(worldModel))
     {
         return false;
     }
     var coins = (int)worldModel.GetProperty(Properties.MONEY);
     return coins < 10;
 }
Esempio n. 17
0
 public override bool CanExecute(WorldModel worldModel)
 {
     if (!base.CanExecute(worldModel))
         return false;
     if (this.Character.BestFlagPosition == null)
         return false;
     var conquerValue = worldModel.GetGoalValue(AutonomousCharacter.CONQUER_GOAL_ID);
     return this.Character.BestCombinedInfluence > 0.0f && conquerValue > 5;
 }
Esempio n. 18
0
        public override bool CanExecute(WorldModel worldModel)
        {
            if (!base.CanExecute(worldModel))
            {
                return false;
            }

            return (int)worldModel.GetProperty(Properties.ARROWS) >= 1;
        }
Esempio n. 19
0
 public override bool CanExecute(WorldModel worldModel)
 {
     if (!base.CanExecute(worldModel))
     {
         return false;
     }
     var arrows = (int)worldModel.GetProperty(Properties.ARROWS);
     return arrows > 0;
 }
Esempio n. 20
0
        public override void ApplyActionEffects(WorldModel worldModel)
        {
            base.ApplyActionEffects(worldModel);

            var surviveValue = worldModel.GetGoalValue(AutonomousCharacter.SURVIVE_GOAL);
            worldModel.SetGoalValue(AutonomousCharacter.SURVIVE_GOAL, surviveValue - 0.5f);
            worldModel.SetProperty(Properties.ARROWS, 10);

            worldModel.SetProperty(this.Target.name, false);
        }
Esempio n. 21
0
File: Rest.cs Progetto: IAJ-g04/Lab8
        public override void ApplyActionEffects(WorldModel worldModel)
        {
            base.ApplyActionEffects(worldModel);

            var restValue = worldModel.GetGoalValue(AutonomousCharacter.REST_GOAL);
            worldModel.SetGoalValue(AutonomousCharacter.REST_GOAL, restValue - 0.1f);

            var energy = (float)worldModel.GetProperty(Properties.ENERGY);
            worldModel.SetProperty(Properties.ENERGY, energy + 0.1f);
        }
        public override bool CanExecute(WorldModel worldModel)
        {
            if (base.CanExecute(worldModel))
            {

              return this.Character.FindSecurityValueForResource(Target.transform.position) > 0;
            }
            else
                return false;
        }
Esempio n. 23
0
        public override void ApplyActionEffects(WorldModel worldModel)
        {
            base.ApplyActionEffects(worldModel);
            var money = (int)worldModel.GetProperty(Properties.MONEY);
            worldModel.SetProperty(Properties.MONEY, money + 5);
            var richGoal = (float)worldModel.GetGoalValue(AutonomousCharacter.GET_RICH_GOAL);
            worldModel.SetGoalValue(AutonomousCharacter.GET_RICH_GOAL, richGoal - 2);

            worldModel.SetProperty(this.Target.name, false);
        }
Esempio n. 24
0
        public override void ApplyActionEffects(WorldModel worldModel)
        {
            base.ApplyActionEffects(worldModel);

            var arrows = (int)worldModel.GetProperty(Properties.ARROWS);
            worldModel.SetProperty(Properties.ARROWS, arrows + 10);

            //disables the target object so that it can't be reused again
            worldModel.SetProperty(this.Target.name, false);
        }
Esempio n. 25
0
        public override void ApplyActionEffects(WorldModel worldModel)
        {
            base.ApplyActionEffects(worldModel);

            var money = worldModel.GetGoalValue(AutonomousCharacter.GET_RICH_GOAL);
            worldModel.SetGoalValue(AutonomousCharacter.GET_RICH_GOAL, money - 5.0f);

            var coins = (int)worldModel.GetProperty(Properties.MONEY);
            worldModel.SetProperty(Properties.MONEY, coins - 5);
            worldModel.SetProperty(this.Target.name, false);
        }
Esempio n. 26
0
        public override void ApplyActionEffects(WorldModel worldModel)
        {
            base.ApplyActionEffects(worldModel);

            var eatValue = worldModel.GetGoalValue(AutonomousCharacter.EAT_GOAL);
            worldModel.SetGoalValue(AutonomousCharacter.EAT_GOAL, eatValue - 2.0f);

            var hunger = (float)worldModel.GetProperty(Properties.HUNGER);
            worldModel.SetProperty(Properties.HUNGER, hunger - 2.0f);

            //disables the target object so that it can't be reused again
            worldModel.SetProperty(this.Target.name, false);
        }
Esempio n. 27
0
        public override void ApplyActionEffects(WorldModel worldModel)
        {
            base.ApplyActionEffects (worldModel);

            var richValue = worldModel.GetGoalValue (AutonomousCharacter.GET_RICH_GOAL);
            worldModel.SetGoalValue (AutonomousCharacter.GET_RICH_GOAL, richValue - 5.0f);

            var money = (int)worldModel.GetProperty (Properties.MONEY);
            worldModel.SetProperty (Properties.HP, money + 5);

            //disables the target object so that it can't be reused again
            worldModel.SetProperty (this.Target.name, false);
        }
Esempio n. 28
0
 public virtual void ApplyActionEffects(WorldModel worldModel)
 {
     //foreach (var effect in this.GoalEffects)
     //{
     //    var previousValue = (float)worldModel.GetProperty(effect.Key);
     //    if (previousValue != null)
     //    {
     //        var nextValue = previousValue + effect.Value;
     //        worldModel.SetProperty(effect.Key, nextValue);
     //        worldModel.SetGoalValue();
     //    }
     //}
 }
Esempio n. 29
0
 public WorldModel(WorldModel parent)
 {
     this.ResourceEnabled = new Dictionary<string, bool>();
     foreach(var key in parent.ResourceEnabled.Keys)
     {
         this.ResourceEnabled[key] = parent.ResourceEnabled[key];
     }
     this.PlayerResources = new Dictionary<string, object>();
     foreach (var key in parent.PlayerResources.Keys)
     {
         this.PlayerResources[key] = parent.PlayerResources[key];
     }
     this.Goals = new Goal[parent.Goals.Length];
     parent.Goals.CopyTo(this.Goals, 0);
     this.gameManager = parent.gameManager;
     this.Actions = parent.Actions;
     this.Parent = parent;
     this.ActionEnumerator = this.Actions.GetEnumerator();
 }
        public override bool CanExecute(WorldModel worldModel)
        {
            if (this.Target == null) return false;
            var targetEnabled = (bool)worldModel.GetProperty(this.Target.name);
            var security = 0.0f;
            if (this.Character.RedInfluenceMap.InProgress || this.Character.GreenInfluenceMap.InProgress)
            {
                return false;
            }
            if (!targetEnabled) return false;
            var node = this.Character.navMesh.QuantizeToNode(this.Target.transform.position, 1.0f);

            if (this.Character.SecurityInfluence.ContainsKey(node.Position))
            {
                security = this.Character.SecurityInfluence[node.Position];

            }

            return targetEnabled && security >= 0;
        }
Esempio n. 31
0
 public virtual float getHValue(WorldModel WorldModel)
 {
     return(0);
 }
Esempio n. 32
0
 public virtual void ApplyActionEffects(WorldModel WorldModel)
 {
 }
Esempio n. 33
0
 public virtual bool CanExecute(WorldModel woldModel)
 {
     return(true);
 }
Esempio n. 34
0
 public virtual float GetDuration(WorldModel WorldModel)
 {
     return(this.Duration);
 }
Esempio n. 35
0
 public virtual float H(WorldModel model)
 {
     return(0.0f);
 }
Esempio n. 36
0
 public virtual float H(WorldModel currentWorldModel)
 {
     return(0.0f);
 }