Ejemplo n.º 1
0
        public override void ApplyActionEffects(WorldModel worldModel)
        {
            base.ApplyActionEffects(worldModel);

            var conqValue = worldModel.GetGoalValue(AutonomousCharacter.CONQUER_GOAL);
            worldModel.SetGoalValue(AutonomousCharacter.CONQUER_GOAL, conqValue - 2.0f);
        }
Ejemplo n.º 2
0
 public override bool CanExecute(WorldModel worldModel)
 {
     if (!base.CanExecute(worldModel)) return false;
     var arr = (int)worldModel.GetProperty(Properties.ARROWS);
     var hh = (float)worldModel.GetProperty(Properties.HUNGER);
     return arr >= 1 && hh > 0.1;
 }
Ejemplo n.º 3
0
Archivo: Rest.cs Proyecto: IAJ-g04/Lab9
        public override bool CanExecute(WorldModel worldModel)
        {
            //if (!base.CanExecute(worldModel)) return false;
            var energy = (float)worldModel.GetProperty(Properties.ENERGY);
            var hn = (float)worldModel.GetProperty(Properties.HUNGER);

            return (energy < 2.0f && hn < 9.5);
        }
Ejemplo n.º 4
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();
 }
Ejemplo n.º 5
0
 public override bool CanExecute(WorldModel worldModel)
 {
     if (!base.CanExecute(worldModel)) return false;
     var hp = (int)worldModel.GetProperty(Properties.HP);
     var ar = (int)worldModel.GetProperty(Properties.ARROWS);
     var hn = (float)worldModel.GetProperty(Properties.HUNGER);
     return hp > 2 && ar < 1 && hn > 5;
 }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
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);

            var energy = (float)worldModel.GetProperty(Properties.ENERGY);
            worldModel.SetProperty(Properties.ENERGY, energy + 1.0f);
        }
Ejemplo n.º 8
0
        public override void ApplyActionEffects(WorldModel worldModel)
        {
            base.ApplyActionEffects(worldModel);

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

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

            //disables the target object so that it can't be reused again
            worldModel.SetProperty(this.Target.name, false);
        }
Ejemplo n.º 9
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();
     //    }
     //}
 }
Ejemplo n.º 10
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);

            var arrows = (int)worldModel.GetProperty(Properties.ARROWS);
            worldModel.SetProperty(Properties.ARROWS, arrows - 1);

            //disables the target object so that it can't be reused again
            worldModel.SetProperty(this.Target.name, false);
        }
Ejemplo n.º 11
0
Archivo: Rest.cs Proyecto: IAJ-g04/Lab9
        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);

            var eatValue = worldModel.GetGoalValue(AutonomousCharacter.EAT_GOAL);
            worldModel.SetGoalValue(AutonomousCharacter.EAT_GOAL, restValue + 0.1f);

            var hunger = (float)worldModel.GetProperty(Properties.HUNGER);
            worldModel.SetProperty(Properties.ENERGY, hunger + 0.1f);
        }
Ejemplo n.º 12
0
 public override bool CanExecute(WorldModel worldModel)
 {
     if (!base.CanExecute(worldModel)) return false;
     var hg = (float)worldModel.GetProperty(Properties.HUNGER);
     var sg = (int)worldModel.GetProperty(Properties.HP);
     var ar = (int)worldModel.GetProperty(Properties.ARROWS);
     if (ar > 5)
         return false;
     if (sg > 2)
     {
         return hg < 8.0f;
     }
     else
     {
         return true;
     }
 }
Ejemplo n.º 13
0
        public override void ApplyActionEffects(WorldModel worldModel)
        {
            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, Target.transform.position);
        }
Ejemplo n.º 14
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 restValue = worldModel.GetGoalValue(AutonomousCharacter.REST_GOAL);
            worldModel.SetGoalValue(AutonomousCharacter.REST_GOAL,restValue+0.5f);
            var surviveValue = worldModel.GetGoalValue(AutonomousCharacter.SURVIVE_GOAL);
            worldModel.SetGoalValue(AutonomousCharacter.SURVIVE_GOAL,surviveValue+2.0f);

            var hp = (int)worldModel.GetProperty(Properties.HP);
            worldModel.SetProperty(Properties.HP,hp-2);
            var energy = (float)worldModel.GetProperty(Properties.ENERGY);
            worldModel.SetProperty(Properties.ENERGY,energy-0.5f);
            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);
        }
Ejemplo n.º 15
0
        public override bool CanExecute(WorldModel worldModel)
        {
            if (!base.CanExecute(worldModel)) return false;
            if (this.Target == null) return false;
            //Secret level 1
            var node = this.Character.navMesh.QuantizeToNode(this.Target.transform.position, 1.0f);

            float redInfluence = this.Character.RedInfluenceMap.GetInfluence(node);
            float greenInfluence = this.Character.GreenInfluenceMap.GetInfluence(node);

            float Security = redInfluence - greenInfluence;
            if (Security <= 0) return false;

            var targetEnabled = (bool)worldModel.GetProperty(this.Target.name);
            var distance =
                  (this.Target.transform.position - this.Character.Character.KinematicData.position).magnitude;
            if (((float)worldModel.GetProperty(Properties.ENERGY) - 0.5f <= (distance *0.01f)) &&
                ((float)worldModel.GetProperty(Properties.HUNGER) - 0.1f <= (distance * 0.1f)))
            {
                return false;
            }
            return targetEnabled;
        }
Ejemplo n.º 16
0
 public override bool CanExecute(WorldModel worldModel)
 {
     if (!base.CanExecute(worldModel)) return false;
     return true; // (worldModel.GetGoalValue(AutonomousCharacter.CONQUER_GOAL) > 5.5f && worldModel.GetGoalValue(AutonomousCharacter.EAT_GOAL) < 8.5f);
 }
Ejemplo n.º 17
0
 public override bool CanExecute(WorldModel worldModel)
 {
     var en = (float)worldModel.GetProperty(Properties.ENERGY);
     return en > 0.2;
 }
Ejemplo n.º 18
0
 public virtual float GetDuration(WorldModel worldModel)
 {
     return this.Duration;
 }
Ejemplo n.º 19
0
 public virtual bool CanExecute(WorldModel woldModel)
 {
     return true;
 }
Ejemplo n.º 20
0
 public override float GetDuration(WorldModel worldModel)
 {
     //assume a velocity of 20.0f/s to get to the target
     var position = (Vector3)worldModel.GetProperty(Properties.POSITION);
     return (this.Target.transform.position - position).magnitude / 20.0f;
 }
Ejemplo n.º 21
0
        public override bool CanExecute(WorldModel worldModel)
        {
            if (!base.CanExecute(worldModel)) return false;

            return (worldModel.GetGoalValue(AutonomousCharacter.REST_GOAL) > 2.5f && worldModel.GetGoalValue(AutonomousCharacter.EAT_GOAL) < 8.5);
        }