Пример #1
0
    IEnumerator releaseCrazy()
    {
        stdWalk = false;
        yield return(StartCoroutine(npc.goToLocator(l3.gameObject, npc)));

        npc.matInteract(mat1);
        yield return(StartCoroutine(npc.goToLocator(crazy, npc)));

        yield return(StartCoroutine(crazy.GetComponent <NPCroutine>().handcuffTo(gameObject)));

        cellDoor.disableInteract = false;
        cellDoor.interact(npc);
        yield return(StartCoroutine(npc.goToLocator(l7.gameObject, npc)));

        yield return(StartCoroutine(npc.goToLocator(l6.gameObject, npc)));

        crazy.GetComponent <NPCroutine>().uncuff();
        crazy.GetComponent <crazyScript>().stage1 = true;
        yield return(StartCoroutine(npc.goToLocator(l3.gameObject, npc)));

        npc.matInteract(mat1);
        stdWalk = true;
        yield return(null);

        c = false;
    }
Пример #2
0
    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 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());
    }