public IEnumerator breakout() { gate.disableInteract = true; float old_s = npc._agent.speed; yield return(StartCoroutine(npc.goToLocator(runToLocator, npc))); if (assignedGaurd.GetComponent <NPCgaurd1script>() != null) { StartCoroutine(assignedGaurd.GetComponent <NPCgaurd1script>().breakout()); } else if (assignedGaurd.GetComponent <NPCgaurd2script>() != null) { StartCoroutine(assignedGaurd.GetComponent <NPCgaurd2script>().breakout()); } else { StartCoroutine(assignedGaurd.GetComponent <NPCgaurd3script>().breakout()); } //yield return StartCoroutine(npc.goToLocator(secondaryLocator, npc)); npc._agent.isStopped = true; //yield return new WaitForSeconds(20.0f); yield return(StartCoroutine(waitForGaurd())); npc._agent.speed = old_s; yield return(StartCoroutine(npc.goToLocator(starter, npc))); hold = true; }
public IEnumerator breakout() { haveTarget = false; stdWalk = false; npc._agent.speed = 10; NPCroutine myRoutine = gameObject.GetComponent <NPCroutine>(); yield return(StartCoroutine(myRoutine.goToLocator(breakoutTarget, npc))); StartCoroutine(breakoutTarget.GetComponent <NPCroutine>().handcuffTo(npc.gameObject)); haveTarget = true; while (!gaurd1.GetComponent <NPCgaurd1script>().haveTarget) { yield return(new WaitForSeconds(0.2f)); } while (!gaurd3.GetComponent <NPCgaurd3script>().haveTarget) { yield return(new WaitForSeconds(0.2f)); } if (myRoutine.ownKey) { //i have the key yield return(StartCoroutine(myRoutine.goToLocator(innerCellLocator1, npc))); if (topDoor.locked) { topDoor.interact(npc); } yield return(StartCoroutine(myRoutine.goToLocator(innerCellLocator2, npc))); readyRelease = true; } else { yield return(new WaitForSeconds(1.0f));//wait for another gaurd to deal with key yield return(StartCoroutine(myRoutine.goToLocator(innerCellLocator2, npc))); readyRelease = true; } while (!gaurd1.GetComponent <NPCgaurd1script>().readyRelease) { yield return(new WaitForSeconds(0.2f)); } while (!gaurd3.GetComponent <NPCgaurd3script>().readyRelease) { yield return(new WaitForSeconds(0.2f)); } breakoutTarget.GetComponent <NPCroutine>().uncuff(); npc._agent.speed = 5; yield return(StartCoroutine(myRoutine.goToLocator(l1, npc))); haveTarget = false; readyRelease = false; stdWalk = true; }
public void FixedUpdate() { if (pt.has(crazyMans)) { move = true; } else { move = false; } if (npc.fighting && !stopped) { print("STOPPING ALL COROUTINES"); StopAllCoroutines(); //npc.StopCoroutine("goToLocator"); StopCoroutine(npc.goToLocator(crazyMans, npc)); stopped = true; } else if (stopped && !npc.fighting) { stopped = false; StartCoroutine(fixedRoutine()); } }
IEnumerator getKeyRoutine() { stdWalk = false; NPCroutine myRoutine = gameObject.GetComponent <NPCroutine>(); _agent.speed = 10; yield return(StartCoroutine(npc.goToLocator(l2.gameObject, npc))); yield return(StartCoroutine(npc.goToLocator(l3.gameObject, npc))); while (!npc.ownKey) { npc.matInteract(mat1); yield return(new WaitForSeconds(0.2f)); } yield return(StartCoroutine(npc.goToLocator(l2.gameObject, npc))); yield return(StartCoroutine(npc.goToLocator(l1.gameObject, npc))); npc.matInteract(mat2); npc.Vspeed = 5; stdWalk = true; yield return(null); }
public IEnumerator getKeyRoutine() { stdWalk = false; npc.Vspeed = 5; npc._agent.speed = 10; NPCroutine myRoutine = gameObject.GetComponent <NPCroutine>(); bottomDoor.disableInteract = true; yield return(StartCoroutine(myRoutine.goToLocator(l2, npc))); while (!mat1.GetComponent <keyMatScript>().holdsKey()) { yield return(new WaitForSeconds(0.2f)); } npc.matInteract(mat1); yield return(StartCoroutine(myRoutine.goToLocator(l6, npc))); bottomDoor.disableInteract = false; bottomDoor.interact(npc); bottomDoor.disableInteract = true; yield return(StartCoroutine(myRoutine.goToLocator(l4, npc))); bottomDoor.disableInteract = false; bottomDoor.interact(npc); bottomDoor.disableInteract = true; yield return(StartCoroutine(myRoutine.goToLocator(crazyPrisoner, npc))); hitCrazy = false; StartCoroutine(crazyPrisoner.GetComponent <NPCroutine>().handcuffTo(npc.gameObject)); print("PARENTED!"); crazyPrisoner.GetComponent <crazyScript>().spreadFear(); npc._agent.speed = 10; yield return(new WaitForSeconds(1.0f)); print("RETURNING..."); yield return(StartCoroutine(myRoutine.goToLocator(l4, npc))); bottomDoor.disableInteract = false; bottomDoor.interact(npc); bottomDoor.disableInteract = true; yield return(StartCoroutine(myRoutine.goToLocator(l6, npc))); bottomDoor.disableInteract = false; bottomDoor.interact(npc); bottomDoor.disableInteract = true; cellDoor.disableInteract = true; yield return(StartCoroutine(myRoutine.goToLocator(l7, npc))); cellDoor.disableInteract = false; cellDoor.interact(npc); cellDoor.disableInteract = true; yield return(StartCoroutine(myRoutine.goToLocator(l3, npc))); crazyPrisoner.GetComponent <NPCroutine>().start_loc = (crazyPrisoner.transform.position); crazyPrisoner.GetComponent <NPCroutine>().setTargetLoc(crazyPrisoner.transform.position); crazyPrisoner.GetComponent <NPCroutine>().uncuff(); yield return(StartCoroutine(myRoutine.goToLocator(l7, npc))); cellDoor.disableInteract = false; cellDoor.interact(npc); cellDoor.disableInteract = true; bottomDoor.disableInteract = false; yield return(StartCoroutine(myRoutine.goToLocator(l2, npc))); yield return(new WaitForSeconds(1.0f)); npc.matInteract(mat1); gaurd2.GetComponent <NPCgaurd2script>().stage1End = true; crazyPrisoner.GetComponent <crazyScript>().stage1 = false; npc.Vspeed = 5; npc._agent.speed = 5; stdWalk = true; StartCoroutine(fixedRoutine()); yield return(null); }
public IEnumerator breakout() { print("starting breakout!"); while (crazyPrisoner.GetComponent <crazyScript>().stage1 == true) { yield return(new WaitForSeconds(0.5f)); } if (!npc.ownKey) { yield return(StartCoroutine(npc.goToLocator(l2.gameObject, npc))); npc.matInteract(mat1); } haveTarget = false; stdWalk = false; npc._agent.speed = 10; NPCroutine myRoutine = gameObject.GetComponent <NPCroutine>(); yield return(StartCoroutine(myRoutine.goToLocator(breakoutTarget, npc))); StartCoroutine(breakoutTarget.GetComponent <NPCroutine>().handcuffTo(npc.gameObject)); yield return(StartCoroutine(myRoutine.goToLocator(breakoutTarget, npc))); haveTarget = true; while (!gaurd2.GetComponent <NPCgaurd2script>().haveTarget) { yield return(new WaitForSeconds(0.2f)); } while (!gaurd3.GetComponent <NPCgaurd3script>().haveTarget) { yield return(new WaitForSeconds(0.2f)); } print("we got em!"); //if (myRoutine.ownKey) //{ // //i have the key // yield return StartCoroutine(myRoutine.goToLocator(innerCellLocator1, npc)); // if (topDoor.locked) // { // topDoor.interact(npc); // } // yield return StartCoroutine(myRoutine.goToLocator(innerCellLocator2, npc)); // readyRelease = true; //} //else //{ yield return(new WaitForSeconds(1.0f)); //wait for another gaurd to deal with key yield return(StartCoroutine(myRoutine.goToLocator(innerCellLocator2, npc))); readyRelease = true; //} while (!gaurd2.GetComponent <NPCgaurd2script>().readyRelease) { yield return(new WaitForSeconds(0.2f)); } while (!gaurd3.GetComponent <NPCgaurd3script>().readyRelease) { yield return(new WaitForSeconds(0.2f)); } print("we placed em!"); breakoutTarget.GetComponent <NPCroutine>().uncuff(); npc._agent.speed = 5; stdWalk = true; yield return(StartCoroutine(gameObject.GetComponent <NPCroutine>().goToLocator(l1, npc))); topDoor.disableInteract = false; topDoor.interact(npc); haveTarget = false; readyRelease = false; StartCoroutine(fixedRoutine()); }