Ejemplo n.º 1
0
    public override IEnumerator TeleportRoutine(AvatarEvent avatar)
    {
        if (avatar.GetComponent <CharaEvent>().facing != dir)
        {
            yield break;
        }

        if (Global.Instance().Memory.GetSwitch("lift_" + floor))
        {
            yield return(base.TeleportRoutine(avatar));
        }
        else
        {
            string oldName  = gameObject.name;
            string origName = GetComponent <MapEvent>().parent.name;
            mapName         = "ElevatorShaft";
            targetEventName = "target";

            yield return(base.TeleportRoutine(avatar));

            avatar.PauseInput();
            yield return(CoUtils.Wait(2.0f));

            yield return(CoUtils.RunParallel(new IEnumerator[] {
                avatar.GetComponent <MapEvent>().StepRoutine(OrthoDir.South),
                CoUtils.Wait(0.4f)
            }, Global.Instance()));

            targetEventName = oldName;
            yield return(Global.Instance().Maps.TeleportRoutine(origName, targetEventName));

            avatar.UnpauseInput();
        }
    }
Ejemplo n.º 2
0
    public virtual IEnumerator TeleportRoutine(AvatarEvent avatar)
    {
        if (avatar.GetComponent <CharaEvent>().facing != dir)
        {
            yield break;
        }
        if (!GetComponent <MapEvent>().switchEnabled)
        {
            yield break;
        }
        if (requiresGlitch && !Global.Instance().Memory.GetSwitch("glitch_on"))
        {
            Global.Instance().Audio.PlaySFX("locked");
            yield break;
        }
        if (requiresLightsOff && !Global.Instance().IsLightsOutMode())
        {
            Global.Instance().Audio.PlaySFX("locked");
            yield break;
        }

        Global.Instance().Audio.PlaySFX("door");

        avatar.PauseInput();
        while (avatar.GetComponent <MapEvent>().tracking)
        {
            yield return(null);
        }
        yield return(animator.PlayRoutine());

        yield return(CoUtils.Wait(animator.frameDuration * 2));

        Vector3 targetPx = avatar.GetComponent <MapEvent>().positionPx + avatar.GetComponent <CharaEvent>().facing.Px3D();

        yield return(CoUtils.RunParallel(new IEnumerator[] {
            avatar.GetComponent <MapEvent>().LinearStepRoutine(targetPx),
            avatar.GetComponent <CharaEvent>().FadeRoutine(1.0f / avatar.GetComponent <MapEvent>().tilesPerSecond * 0.75f)
        }, this));

        yield return(CoUtils.Wait(animator.frameDuration * 2));

        yield return(Global.Instance().Maps.TeleportRoutine(mapName, targetEventName));

        yield return(avatar.GetComponent <MapEvent>().StepRoutine(avatar.GetComponent <CharaEvent>().facing));

        avatar.UnpauseInput();
    }