public static bool InteractZone_UpdateInteractVolume(InteractZone __instance)
        {
            /* Angle for interaction with the ship hatch
             *
             *  \  80°  / - If in ship
             *   \     /
             *    \   /
             *   [=====]  - Hatch
             *    /   \
             *   /     \
             *  / 280°  \ - If not in ship
             *
             */

            if (!QSBWorldSync.AllObjectsReady || __instance != ShipManager.Instance.HatchInteractZone)
            {
                return(true);
            }

            var angle = 2f * Vector3.Angle(__instance._playerCam.transform.forward, __instance.transform.forward);

            __instance._focused = PlayerState.IsInsideShip()
                                ? angle <= 80
                                : angle >= 280;

            SingleInteractionVolume_UpdateInteractVolume_Stub(__instance);

            return(false);
        }
Esempio n. 2
0
 static bool InteractZoneEntry(GameObject hitObj, InteractZone __instance)
 {
     if (hitObj.CompareTag("PlayerDetector"))
     {
         _manipulator.OnEnterInteractZone(__instance);
     }
     return(false);
 }
Esempio n. 3
0
 private static bool PreInteractZoneExit(GameObject hitObj, InteractZone __instance)
 {
     if (hitObj.CompareTag("PlayerDetector"))
     {
         _manipulator.OnExitInteractZone(__instance);
     }
     return(false);
 }
Esempio n. 4
0
                private static bool PreUpdateInteractVolume(
                    InteractZone __instance,
                    float ____viewingWindow,
                    ref bool ____focused
                    )
                {
                    var num = 2f * Vector3.Angle(Laser.forward, __instance.transform.forward);
                    var allowInteraction = ToolHelper.IsUsingNoTools();

                    ____focused = allowInteraction && num <= ____viewingWindow;
                    var Base = __instance as SingleInteractionVolume;

                    var method = typeof(SingleInteractionVolume).GetMethod("UpdateInteractVolume");
                    var ftn    = method.MethodHandle.GetFunctionPointer();
                    var func   = (Action)Activator.CreateInstance(typeof(Action), __instance, ftn);

                    func();

                    return(false);
                }
Esempio n. 5
0
        static bool PatchUpdateInteractVolume(
            InteractZone __instance,
            OWCamera ____playerCam,
            float ____viewingWindow,
            ref bool ____focused
            )
        {
            float num = 2f * Vector3.Angle(-MainClass.interactObject.transform.forward, __instance.transform.forward);

            ____focused = (num <= ____viewingWindow);
            var Base = __instance as SingleInteractionVolume;

            var method = typeof(SingleInteractionVolume).GetMethod("UpdateInteractVolume");
            var ftn    = method.MethodHandle.GetFunctionPointer();
            var func   = (Action)Activator.CreateInstance(typeof(Action), __instance, ftn);

            func();

            return(false);
        }
Esempio n. 6
0
            static bool PatchUpdateInteractVolume(
                InteractZone __instance,
                float ____viewingWindow,
                ref bool ____focused
                )
            {
                float num              = 2f * Vector3.Angle(Laser.forward, __instance.transform.forward);
                var   swapper          = Locator.GetToolModeSwapper();
                var   allowInteraction = swapper.IsInToolMode(ToolMode.None) || swapper.IsInToolMode(ToolMode.Item);

                ____focused = allowInteraction && num <= ____viewingWindow;
                var Base = __instance as SingleInteractionVolume;

                var method = typeof(SingleInteractionVolume).GetMethod("UpdateInteractVolume");
                var ftn    = method.MethodHandle.GetFunctionPointer();
                var func   = (Action)Activator.CreateInstance(typeof(Action), __instance, ftn);

                func();

                return(false);
            }
Esempio n. 7
0
    private void Start()
    {
        zone = GetComponentInChildren <InteractZone>();

        zone.OnEnter += (gameObj) =>
        {
            inZone           = true;
            doorText.enabled = inZone && betweenWaves;
        };

        zone.OnExit += (gameObj) =>
        {
            doorText.enabled = false;
            inZone           = false;
        };

        events  = GameManager.Instance.Events;
        enabled = true;

        events.AddListener <WaveStarted>(this.gameObject, OnWaveStart);
        events.AddListener <WaveEnded>(this.gameObject, OnWaveEnd);
    }
Esempio n. 8
0
    private void OnTriggerExit2D(Collider2D other)
    {
        if (other.tag == "PuzzleShellTwoInteractZone")
        {
            ShellPuzzleTwo shell = other.GetComponentInParent <ShellPuzzleTwo>();
            shell.InactiveButtonSprite();
        }

        if (other.tag == "InteractZone")
        {
            InteractZone zone = other.GetComponent <InteractZone>();

            if (!zone.buttonisActivated)
            {
                zone.InactiveButtonSprite();
            }
        }

        if (other.tag == "GrassZone")
        {
            playerSoundManager.surface = PlayerSoundManager.Surface.sand;
        }
    }
Esempio n. 9
0
 private void CreateButton()
 {
     button     = Instantiate(buttonToCreate, new Vector3(transform.position.x, transform.position.y - 1.57f, 0f), Quaternion.identity);
     buttonZone = button.GetComponent <InteractZone>();
 }
Esempio n. 10
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "Pearl")
        {
            AudioSource pearlAudio = other.GetComponent <AudioSource>();
            if (pearlAudio.isPlaying)
            {
                pearlAudio.Stop();
            }

            Pearl pearl = other.GetComponent <Pearl>();

            if (collisionChecker.collisions.above)
            {
                pearl.MoveUp();
            }
            else if (collisionChecker.collisions.below)
            {
                pearl.MoveDown();
            }
            else if (collisionChecker.collisions.left)
            {
                pearl.MoveLeft();
            }
            else if (collisionChecker.collisions.right)
            {
                pearl.MoveRight();
            }
        }

        if (other.tag == "PearlInteractZone")
        {
            Pearl pearl = other.GetComponentInParent <Pearl>();

            if (!pearl.hasBeenPushed)
            {
                pearl.PlayPuzzleSound();
            }
        }

        if (other.tag == "InteractZone")
        {
            InteractZone zone = other.GetComponent <InteractZone>();
            zone.ActivatedButtonSprite();
        }

        if (other.tag == "PuzzleShellTwo")
        {
            ShellPuzzleTwo shell = other.GetComponent <ShellPuzzleTwo>();
            shell.ActivateShell();
        }

        if (other.tag == "PuzzleShellTwoInteractZone")
        {
            ShellPuzzleTwo shell = other.GetComponentInParent <ShellPuzzleTwo>();
            shell.PlayShellSound();
            shell.ActivatedButtonSprite();
        }

        if (other.tag == "PuzzleButtonOne")
        {
            PuzzleButtonOne button = other.GetComponentInParent <PuzzleButtonOne>();

            if (!button.isPuzzleSolved)
            {
                button.PlayPuzzleSounds();
            }
        }

        if (other.tag == "PuzzleButtonTwo")
        {
            PuzzleButtonTwo button = other.GetComponentInParent <PuzzleButtonTwo>();

            if (!button.isPuzzleSolved)
            {
                button.PlayPuzzleSounds();
            }
        }

        if (other.tag == "PuzzleButtonThree")
        {
            PuzzleButtonThree button = other.GetComponent <PuzzleButtonThree>();

            if (!button.isPuzzleSolved)
            {
                button.ActivateDialogueBox();
                canMove = false;
            }
        }

        if (other.tag == "EnterZone")
        {
            MountainEntry mountain = other.GetComponent <MountainEntry>();

            int mountainNumber = mountain.mountainNumber;
            gameManager.currentMountainNumber = mountainNumber;

            mountain.EnterMountain();
        }

        if (other.tag == "ExitZone")
        {
            gameManager.playerExitingMountain = true;
            MountainExit mountain = other.GetComponent <MountainExit>();
            mountain.ExitMountain();
        }

        if (other.tag == "GrassZone")
        {
            playerSoundManager.surface = PlayerSoundManager.Surface.grass;
        }
    }