示例#1
0
    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);
    }