// Start is called before the first frame update new void Start() { base.Start(); SubGoal s1 = new SubGoal("treatPatient", 1, true); goals.Add(s1, 3); }
protected override void Start() { FoodTargets = new List <Transform>(); PredatorTargets = new List <Transform>(); base.Start(); PredatorDetected = false; FoodDetected = false; Detection = GetComponent <UnitDetection>(); Eater = GetComponent <IEater>(); Eatable = GetComponent <IEatable>(); Exhausted = GetComponent <Exhaustion>(); SubGoal s1 = new SubGoal(State.NotHungry, 1, false); // Add it to the goals goals.Add(s1, 0); SubGoal s2 = new SubGoal(State.NotExhausted, 1, false); // Add it to the goals goals.Add(s2, 0); SubGoal s3 = new SubGoal(State.NotEaten, 1, false); // Add it to the goals goals.Add(s3, 2); Detection.OnTargetsUpdated += FilterEatableTargets; Detection.OnTargetsUpdated += FilterEaterTargets; }
// Start is called before the first frame update void Start() { base.Start(); SubGoal s1 = new SubGoal("isWaiting", 1, true); goals.Add(s1, 3); }
new void Start() { // Call the base start base.Start(); // Set up the subgoal "isWaiting" SubGoal s1 = new SubGoal("isWaiting", 1, true); // Add it to the goals goals.Add(s1, 3); // Set up the subgoal "isTreated" SubGoal s2 = new SubGoal("isTreated", 1, true); // Add it to the goals goals.Add(s2, 5); // Set up the subgoal "isHome" SubGoal s3 = new SubGoal("isHome", 1, true); // Add it to the goals goals.Add(s3, 1); // Set up the subgoal "relief" SubGoal s4 = new SubGoal("relief", 1, false); // Add it to the goals goals.Add(s4, 3); Invoke("NeedRelief", Random.Range(2.0f, 5.0f)); }
// Start is called before the first frame update void Start() { base.Start(); SubGoal sg = new SubGoal("GoHome", 1, true); goals.Add(sg, 3); }
void LateUpdate() { if (currentAction != null && currentAction.running) { float distanceToTarget = Vector3.Distance(currentAction.target.transform.position, this.transform.position); if (currentAction.agent.hasPath && distanceToTarget < 2.0f) { if (!invoked) { Invoke("CompleteAction", currentAction.duration); invoked = true; } } return; } if (planner == null || actionQueue == null) { planner = new GPlanner(); var sortedGoals = from entry in goals orderby entry.Value descending select entry; foreach (KeyValuePair <SubGoal, int> sg in sortedGoals) { actionQueue = planner.plan(actions, sg.Key.sgoals, beliefs); if (actionQueue != null) { currentGoal = sg.Key; break; } } } if (actionQueue != null && actionQueue.Count == 0) { if (currentGoal.remove) { goals.Remove(currentGoal); } planner = null; } if (actionQueue != null && actionQueue.Count > 0) { currentAction = actionQueue.Dequeue(); if (currentAction.PrePerform()) { if (currentAction.target == null && currentAction.targetTag != "") { currentAction.target = GameObject.FindWithTag(currentAction.targetTag); } if (currentAction.targetTag != null) { currentAction.running = true; currentAction.agent.SetDestination(currentAction.target.transform.position); } } else { actionQueue = null; } } }
new void Start() { EnemyManager.OnEnemyTriggerEnter += onEnemyTrigger; //GetComponent<NavMeshAgent>().speed = settings.speed; // Call the base start base.Start(); // Set up the subgoal "isWaiting" SubGoal s1 = new SubGoal("Safe", 4, true); // Add it to the goals goals.Add(s1, 6); SubGoal s2 = new SubGoal("Dodge", 1, false); goals.Add(s2, 1); SubGoal s3 = new SubGoal("KillPlayer", 3, false); goals.Add(s3, 5); SubGoal s4 = new SubGoal("Armed", 4, true); // Add it to the goals goals.Add(s4, 6); SubGoal s5 = new SubGoal("Patrol", 4, false); goals.Add(s5, 5); InvokeRepeating("ReturnBeliefs", 0.1f, 0.1f); agent = this.gameObject.GetComponent <NavMeshAgent>(); //GetComponent<NavMeshAgent>().Warp; beliefs.ModifyState("NotActivated", 0); //keeps enemy from active aggression (keeps passive until damage is taken target = agent.transform; // place holder so enemies won't crash target = GameObject.FindGameObjectWithTag("Player").transform; lastPos = transform.position; }
List <OptionN> createOptFromSubGoals(List <SubGoal> subgoals) { List <OptionN> options = new List <OptionN>(); for (int i = 0; i < subgoals.Count; i++) { SubGoal s = subgoals[i]; OptionN o = new OptionN(s.State, this); options.Add(o); for (int j = 0; j < Model[s.State].Count; j++) { if (Model[s.State][j] == null) { continue; } if (Q[s.State].Actions[j].O != null) { continue; } o.AddSASp(s.State, j, Model[s.State][j].sP); constOptionN(subgoals, s, o, Model[s.State][j].sP); } } return(options); }
// Start is called before the first frame update new void Start() { base.Start(); SubGoal deliver = new SubGoal("DeliverOrder", 1, false); goals.Add(deliver, 3); }
// Start is called before the first frame update new void Start() { base.Start(); SubGoal s1 = new SubGoal("gatherReq", 1, false); goals.Add(s1, 3); }
void LateUpdate() { if (currentAction != null && currentAction.running) { if (currentAction.agent.hasPath && currentAction.agent.remainingDistance < 1f) { if (!invoked) { Invoke("CompleteAction", currentAction.duration); invoked = true; } } return; } if (planner == null || actionQueue == null) { planner = new GOAPPlanner(); var sortedGoals = from entry in goals orderby entry.Value descending select entry; foreach (KeyValuePair <SubGoal, int> sg in sortedGoals) { actionQueue = planner.plan(actions, sg.Key.sgoals, null); if (actionQueue != null) { currentGoal = sg.Key; break; } } } if (actionQueue != null && actionQueue.Count == 0) { if (currentGoal.remove) { goals.Remove(currentGoal); } planner = null; } if (actionQueue != null && actionQueue.Count > 0) { currentAction = actionQueue.Dequeue(); if (currentAction.PrePerform()) { if (currentAction.target != null) { currentAction.running = true; currentAction.agent.SetDestination(currentAction.target.transform.position); } } else { actionQueue = null; } } }
// Start is called before the first frame update new void Start() { base.Start(); SubGoal s1 = new SubGoal("ReqAddressed", 1, false); goals.Add(s1, 3); //SubGoal s2 = new SubGoal("isWaiting", 1, true); //goals.Add(s2, 3); }
// Start is called before the first frame update new void Start() { base.Start(); SubGoal s1 = new SubGoal("CodeImplemented", 1, false); goals.Add(s1, 3); //SubGoal s2 = new SubGoal("isWaiting", 1, true); //goals.Add(s2, 3); }
public override void Start() { base.Start(); var s1 = new SubGoal("isWaiting", 1, true); var priority = 3; Goals.Add(s1, priority); }
new void Start() { wolf = GameObject.FindWithTag("Player"); base.Start(); SubGoal s1 = new SubGoal("goToFlower", 1, false); goals.Add(s1, 1); InvokeRepeating("TimeToHungry", 0, Random.Range(60f, 70f)); }
// Start is called before the first frame update void Start() { base.Start(); SubGoal s1 = new SubGoal("isWaiting", 1, true); goals.Add(s1, 3); guiStyle = new GUIStyle(); guiStyle.normal.textColor = Color.black; }
// Start is called before the first frame update new void Start() { base.Start(); SubGoal s1 = new SubGoal("treatPatient", 1, false); goals.Add(s1, 3); SubGoal s2 = new SubGoal("rested", 1, false); goals.Add(s2, 3); Invoke("GetTired", Random.Range(10, 20)); }
// Start is called before the first frame update new void Start() { base.Start(); SubGoal s1 = new SubGoal("smithTool", 1, false); goals.Add(s1, 1); SubGoal s2 = new SubGoal("depositTool", 1, false); goals.Add(s2, 3); }
// Start is called before the first frame update new void Start() { base.Start(); SubGoal s1 = new SubGoal("isWaiting", 1, true); goals.Add(s1, 3); SubGoal s2 = new SubGoal("isTreated", 1, true); goals.Add(s2, 5); }
// Start is called before the first frame update public void Start() { base.Start(); SubGoal waiting = new SubGoal(AgentStates.isWaiting, 1, true); goals.Add(waiting, 3); //TODO: This breaks patient behavior. SubGoal goHome = new SubGoal(AgentStates.atHome, 3, true); goals.Add(goHome, 5); }
// Start is called before the first frame update public void Start() { base.Start(); SubGoal s1 = new SubGoal(AgentStates.treatPatient, 2, false); goals.Add(s1, 3); SubGoal lunchBreak = new SubGoal(AgentStates.rested, 1, false); goals.Add(lunchBreak, 5); Invoke(nameof(GetTired), Random.Range(10, 20)); }
// Start is called before the first frame update new void Start() { base.Start(); SubGoal wait = new SubGoal("Wait", 1, false); SubGoal placeOrders = new SubGoal("PlaceOrder", 1, false); SubGoal deliver = new SubGoal("DeliverOrder", 1, false); goals.Add(wait, 1); goals.Add(placeOrders, 2); goals.Add(deliver, 3); }
// Start is called before the first frame update new void Start() { base.Start(); SubGoal placeOrder = new SubGoal("PlaceOrder", 1, true); SubGoal eat = new SubGoal("Eat", 1, true); SubGoal leave = new SubGoal("Leave", 1, true); goals.Add(placeOrder, 1); goals.Add(eat, 2); goals.Add(leave, 3); beliefs.ModifyState("GoToRestaurant", 1); }
// Start is called before the first frame update new void Start() { base.Start(); SubGoal s1 = new SubGoal("treatPatient", 1, false); goals.Add(s1, 3); //add the subgoal and it's importance SubGoal s2 = new SubGoal("rested", 1, false); goals.Add(s2, 1); Invoke("GetTired", Random.Range(10, 20)); }
protected void OnEnable() { base.Start(); SubGoal s1 = new SubGoal("isWaiting", 1, true); goals.Add(s1, 3); SubGoal s2 = new SubGoal("isTreated", 1, true); goals.Add(s2, 5); SubGoal s3 = new SubGoal("isHome", 1, true); goals.Add(s3, 10000); }
protected override void Start() { base.Start(); SubGoal s1 = new SubGoal("treatPatient", 1, false); goals.Add(s1, 3); SubGoal s2 = new SubGoal("rested", 1, false); goals.Add(s2, 1); Invoke(nameof(GetTired), UnityEngine.Random.Range(20, 50)); }
// Start is called before the first frame update protected override void Start() { base.Start(); SubGoal s1 = new SubGoal("clean", 1, false); goals.Add(s1, 2); SubGoal s2 = new SubGoal("rested", 1, false); goals.Add(s2, 1); Invoke("GetTired", Random.Range(10, 20)); }
// Start is called before the first frame update new void Start() { base.Start(); SubGoal s1 = new SubGoal("goTarget", 1, false); goals.Add(s1, 1); SubGoal s2 = new SubGoal("timeToEat", 1, false); goals.Add(s2, 1); InvokeRepeating("TimeToEat", Random.Range(15, 30), Random.Range(15, 30)); }
// Start is called before the first frame update new void Start() { base.Start(); // Nurse must repeat goal after each trated patient. SubGoal s1 = new SubGoal("treatPatient", 1, false); goals.Add(s1, 3); SubGoal s2 = new SubGoal("rested", 1, false); goals.Add(s2, 3); Invoke("GetTired", Random.Range(10, 20)); }
new void Start() //(new is because GAgent has a Start()) { base.Start(); //GAgent inherited Start() //Sub Goals SubGoal s1 = new SubGoal("IsWaiting", 1, true); Goals.Add(s1, 3); SubGoal s2 = new SubGoal("IsTreated", 1, true); Goals.Add(s2, 5); SubGoal s3 = new SubGoal("IsHome", 1, true); }