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); }
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); }
public override bool CanExecute(WorldModel worldModel) { if (!base.CanExecute(worldModel)) return false; var energy = (float) worldModel.GetProperty(Properties.ENERGY); return energy < 5.0f; }
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; }
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 = (bool)worldModel.GetProperty (this.Target.name); return targetEnabled; }
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); }
public override bool CanExecute(WorldModel worldModel) { if (!base.CanExecute(worldModel)) { return false; } var coins = (int)worldModel.GetProperty(Properties.MONEY); return coins < 10; }
public override bool CanExecute(WorldModel worldModel) { if (!base.CanExecute(worldModel)) { return false; } return (int)worldModel.GetProperty(Properties.ARROWS) >= 1; }
public override bool CanExecute(WorldModel worldModel) { if (!base.CanExecute(worldModel)) { return false; } var arrows = (int)worldModel.GetProperty(Properties.ARROWS); return arrows > 0; }
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 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); }
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); }
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); }
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); }
public override void ApplyActionEffects(WorldModel worldModel) { base.ApplyActionEffects(worldModel); var eatValue = worldModel.GetGoalValue(AutonomousCharacter.EAT_GOAL_ID); worldModel.SetGoalValue(AutonomousCharacter.EAT_GOAL_ID,eatValue-2.0f); var restValue = worldModel.GetGoalValue(AutonomousCharacter.REST_GOAL_ID); worldModel.SetGoalValue(AutonomousCharacter.REST_GOAL_ID,restValue+0.5f); var surviveValue = worldModel.GetGoalValue(AutonomousCharacter.SURVIVE_GOAL_ID); worldModel.SetGoalValue(AutonomousCharacter.SURVIVE_GOAL_ID,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); }
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); }
public override void ApplyActionEffects(WorldModel worldModel) { base.ApplyActionEffects(worldModel); var duration = this.GetDuration(worldModel); var energyChange = duration * 0.01f; var hungerChange = duration * 0.1f; var restValue = worldModel.GetGoalValue(AutonomousCharacter.REST_GOAL_ID); worldModel.SetGoalValue(AutonomousCharacter.REST_GOAL_ID, restValue + energyChange); var energy = (float)worldModel.GetProperty(Properties.ENERGY); worldModel.SetProperty(Properties.ENERGY, energy - energyChange); var eatGoalValue = worldModel.GetGoalValue(AutonomousCharacter.EAT_GOAL_ID); worldModel.SetGoalValue(AutonomousCharacter.EAT_GOAL_ID, eatGoalValue + hungerChange); var hunger = (float)worldModel.GetProperty(Properties.HUNGER); worldModel.SetProperty(Properties.HUNGER, hunger + hungerChange); var conquerValue = worldModel.GetGoalValue(AutonomousCharacter.CONQUER_GOAL_ID); worldModel.SetGoalValue(AutonomousCharacter.CONQUER_GOAL_ID, conquerValue - 2.0f); }
public override bool CanExecute(WorldModel worldModel) { if (this.Target == null) return false; var targetEnabled = (bool)worldModel.GetProperty(this.Target.name); if (!targetEnabled) return false; NavigationGraphNode targetNode = this.Character.navMesh.QuantizeToNode(this.Target.transform.position, 10.0f); LocationRecord rec = new LocationRecord() { Location = targetNode }; float security = 0.0f; if (this.Character.SecurityMap.ContainsKey(rec)) { security = this.Character.SecurityMap[rec]; } if (security >= 0.0f) return true; return false; }
public override bool CanExecute(WorldModel worldModel) { return (float)worldModel.GetProperty(Properties.ENERGY) < 9.0f; }
public override float GetDuration(WorldModel worldModel) { var position = (Vector3)worldModel.GetProperty(Properties.POSITION); return (this.Character.BestFlagPosition - position).magnitude / 20.0f; }
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.Character.BestFlagPosition - position).magnitude / 20.0f; }
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; }
public WorldModel(WorldModel parent) { this.Properties = new object[22]; this.Properties[0] = parent.GetProperty("HP"); this.Properties[1] = parent.GetProperty("MAXHP"); this.Properties[2] = parent.GetProperty("Mana"); this.Properties[3] = parent.GetProperty("XP"); this.Properties[4] = parent.GetProperty("Money"); this.Properties[5] = parent.GetProperty("Level"); this.Properties[6] = parent.GetProperty("Time"); this.Properties[7] = parent.GetProperty("Position"); this.Properties[8] = parent.GetProperty("Dragon"); this.Properties[9] = parent.GetProperty("Orc"); this.Properties[10] = parent.GetProperty("Orc (1)"); this.Properties[11] = parent.GetProperty("Skeleton (2)"); this.Properties[12] = parent.GetProperty("Skeleton (3)"); this.Properties[13] = parent.GetProperty("ManaPotion"); this.Properties[14] = parent.GetProperty("ManaPotion (1)"); this.Properties[15] = parent.GetProperty("HealthPotion"); this.Properties[16] = parent.GetProperty("HealthPotion (1)"); this.Properties[17] = parent.GetProperty("Chest"); this.Properties[18] = parent.GetProperty("Chest (1)"); this.Properties[19] = parent.GetProperty("Chest (2)"); this.Properties[20] = parent.GetProperty("Chest (3)"); this.Properties[21] = parent.GetProperty("Chest (4)"); this.Goals = new float[4]; this.Goals[0] = parent.GetGoalValue("Survive"); this.Goals[1] = parent.GetGoalValue("GainXP"); this.Goals[2] = parent.GetGoalValue("BeQuick"); this.Goals[3] = parent.GetGoalValue("GetRich"); this.Actions = parent.Actions; this.ActionEnumerator = this.Actions.GetEnumerator(); }
public override bool CanExecute(WorldModel worldModel) { if (!base.CanExecute()) return false; return (float)worldModel.GetProperty(Properties.ENERGY) > 3.0f && (int)worldModel.GetProperty(Properties.ARROWS) < 3; }
public override bool CanExecute(WorldModel worldModel) { if (!base.CanExecute(worldModel)) return false; var hp = (int)worldModel.GetProperty(Properties.HP); return hp > 2; }