Exemple #1
0
    // If the player is holding down Jump, throw the coin downwards biased against the player's movement.
    // If the player is not jumping, the hand follows the camera.
    void Update()
    {
        Debug.DrawLine(start, tragectory + start);
        if (Keybinds.Jump())
        {
            float vertical   = -Keybinds.Vertical() * baseSteepAngle;
            float horizontal = -Keybinds.Horizontal() * baseSteepAngle;

            if (SettingsMenu.settingsData.controlScheme != SettingsData.Gamepad)
            {
                // If using keyboard, throw coins at a steeper angle
                vertical   *= keyboardSteepAngle;
                horizontal *= keyboardSteepAngle;
            }
            Quaternion newRotation = new Quaternion();
            newRotation.SetLookRotation(new Vector3(horizontal, (-1 + Vector2.ClampMagnitude(new Vector2(horizontal, vertical), 1).magnitude), vertical), Vector3.up);
            centerOfMass.rotation = CameraController.CameraDirection * newRotation;
        }
        else
        {
            // Rotate hand to look towards reticle target
            RaycastHit hit;
            if (Physics.Raycast(CameraController.ActiveCamera.transform.position, CameraController.ActiveCamera.transform.forward, out hit, 1000, GameManager.Layer_IgnorePlayer))
            {
                centerOfMass.LookAt(hit.point);
            }
            else
            {
                centerOfMass.eulerAngles = CameraController.ActiveCamera.transform.eulerAngles;
            }
        }
    }
Exemple #2
0
    // If the player is holding down Jump, throw the coin downwards biased against the player's movement.
    // If the player is not jumping, the hand follows the camera.
    void Update()
    {
        if (Keybinds.Jump())
        {
            float vertical   = -Keybinds.Vertical() * baseSteepAngle;
            float horizontal = -Keybinds.Horizontal() * baseSteepAngle;

            if (!GamepadController.UsingGamepad)
            {
                // If using keyboard, throw coins at a steeper angle
                vertical   *= keyboardSteepAngle;
                horizontal *= keyboardSteepAngle;
            }

            Quaternion newRotation = new Quaternion();
            newRotation.SetLookRotation(new Vector3(horizontal, (-1 + Vector2.ClampMagnitude(new Vector2(horizontal, vertical), 1).magnitude), vertical), Vector3.up);
            centerOfMass.localRotation = newRotation;
        }
        else
        {
            centerOfMass.localEulerAngles = new Vector3(CameraController.ActiveCamera.transform.eulerAngles.x, 0, 0);
        }
    }
Exemple #3
0
    IEnumerator WaitForAction()
    {
        if (coroutinePosition < actions.Length)
        {
            switch (actions[coroutinePosition])
            {
            case Action.MoveWASD: {
                while (Player.PlayerInstance.GetComponent <Rigidbody>().velocity == Vector3.zero)
                {
                    yield return(null);
                }
                break;
            }

            case Action.StartBurningIronSteel: {
                while (!Player.PlayerIronSteel.IsBurning)
                {
                    yield return(null);
                }
                break;
            }

            case Action.SelectSteel: {
                while (!Keybinds.SelectAlternateDown())
                {
                    yield return(null);
                }
                break;
            }

            case Action.PushPull: {
                bool pulled = false;
                bool pushed = false;
                while (!pulled || !pushed)
                {
                    pulled = pulled || Keybinds.IronPulling();
                    pushed = pushed || Keybinds.SteelPushing();
                    yield return(null);
                }
                break;
            }

            case Action.Deselect: {
                bool select    = false;
                bool alternate = false;
                while (!select || !alternate)
                {
                    select    = select || (Keybinds.Negate() && Keybinds.Select());
                    alternate = alternate || (Keybinds.Negate() && Keybinds.SelectAlternate());
                    yield return(null);
                }
                break;
            }

            case Action.Help: {
                while (!HUD.HelpOverlayController.IsOpen)
                {
                    yield return(null);
                }
                // Close Message
                Close();
                break;
            }

            case Action.ChangeNumberOfTargets: {
                while (Player.PlayerIronSteel.PullTargets.Size == 1)
                {
                    yield return(null);
                }
                break;
            }

            case Action.ChangeBurnPercentage: {
                while (Player.PlayerIronSteel.IronBurnPercentageTarget > .99f && Player.PlayerIronSteel.SteelBurnPercentageTarget > .99f)
                {
                    yield return(null);
                }
                break;
            }

            case Action.StopBurningIronSteel: {
                while (Player.PlayerIronSteel.IsBurning)
                {
                    yield return(null);
                }
                Close();
                break;
            }

            case Action.CollectCoin: {
                while (Player.PlayerInstance.CoinHand.Pouch.Count == 0)
                {
                    yield return(null);
                }
                break;
            }

            case Action.ThrowCoin: {
                while (!Keybinds.WithdrawCoinDown())
                {
                    yield return(null);
                }
                break;
            }

            case Action.ThrowCoinDown: {
                while (!Keybinds.WithdrawCoinDown() || !Keybinds.Jump())
                {
                    yield return(null);
                }
                FlagsController.HelpOverlayFull = true;
                break;
            }

            case Action.SelectIron: {
                while (!Keybinds.SelectDown())
                {
                    yield return(null);
                }
                break;
            }

            case Action.BurnPewter: {
                while (!Player.PlayerPewter.IsSprinting)
                {
                    yield return(null);
                }
                break;
            }
            }

            // When one TriggerBeadPopup is entered, make sure no other TriggerBead listeners are still running to update the MessageOverlay later on.
            if (HUD.MessageOverlayController.CurrentPopup == this)
            {
                coroutinePosition++;
                HUD.MessageOverlayController.MessageText.text = GetText();
                HUD.MessageOverlayController.HeaderText.text  = GetHeader();
                if (coroutinePosition < HUD.MessageOverlayController.TriggerBeadMessages[section].Count - 2 || coroutinePosition < actions.Length)
                {
                    StartCoroutine(WaitForAction());
                    yield break;
                }
            }
        }
        // End of this bead's actions
        if (nextBead)
        {
            nextBead.transform.parent.gameObject.SetActive(true);
        }
    }