コード例 #1
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (!inputIsDisabled)
        {
            var lAxis = new Vector2(Input.GetAxis(LowerHorizontal), Input.GetAxis(LowerVertical));
            if (lAxis.magnitude > DeadZone)
            {
                LowerAimPoint.position = this.transform.position + new Vector3(lAxis.x, 0f, lAxis.y) * SeparationFactor;
                lowerMover.Move();
            }

            var uAxis = new Vector2(Input.GetAxis(UpperHorizontal), Input.GetAxis(UpperVertical));
            if (uAxis.magnitude > DeadZone)
            {
                UpperAimPoint.position = UpperMover.transform.position + new Vector3(uAxis.x, 0f, uAxis.y) * SeparationFactor;
                UpperMover.Move();
            }

            if (Input.GetButton(PrimaryFire))
            {
                foreach (var w in bot.Weapons.PrimaryWeapon)
                {
                    w.Fire();
                }
            }

            var tAxis = Input.GetAxis(Triggers);

            if (tAxis <= -0.9f)
            {
                lowerMover.DashForward();
            }
        }
        else
        {
            inputDisableElapsed -= Time.fixedDeltaTime;
            if (inputDisableElapsed < 0)
            {
                inputIsDisabled = false;
            }
        }
    }
コード例 #2
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (!inputIsDisabled)
        {
            var lAxis = new Vector2(Input.GetAxis(LowerHorizontal), Input.GetAxis(LowerVertical));
            if (lAxis.magnitude > DeadZone)
            {
                LowerAimPoint.position = this.transform.position + new Vector3(lAxis.x, 0f, lAxis.y) * SeparationFactor;
                lowerMover.Move();
            }

            var uAxis = new Vector2(Input.GetAxis(UpperHorizontal), Input.GetAxis(UpperVertical));
            if (uAxis.magnitude > DeadZone)
            {
                UpperAimPoint.position = UpperMover.transform.position + new Vector3(uAxis.x, 0f, uAxis.y) * SeparationFactor;
                UpperMover.Move();
            }

            if (Input.GetButton(PrimaryFire))
            {
                bot.Weapons.PrimaryWeapon.OnFire();
            }

            if (Input.GetButtonDown(SecondaryFire))
            {
                bot.Weapons.SecondaryWeapon.Fire();
            }

            var tAxis = Input.GetAxis(Triggers);

            if (tAxis <= -0.9f)
            {
                lowerMover.DashForward();
            }

            if (tAxis >= 0.9f)
            {
                bot.Weapons.MeleeWeapon.OnFire();
            }
//------------------------------------------------------ Codigo Bruno
            var dPadV = Input.GetAxisRaw(VArrow);

            if (dPadV == 1 && !DPadVPressed)
            {
                taunt.TriggerTaunt(0);
                DPadVPressed = true;
            }

            if (dPadV == -1 && !DPadVPressed)
            {
                taunt.TriggerTaunt(1);
                DPadVPressed = true;
            }

            if (dPadV == 0)
            {
                DPadVPressed = false;
            }

            var dPadH = Input.GetAxisRaw(HArrow);

            if (dPadH == 1 && !DPadHPressed)
            {
                taunt.TriggerTaunt(2);
                DPadHPressed = true;
            }

            if (dPadH == -1 && !DPadHPressed)
            {
                taunt.TriggerTaunt(3);
                DPadHPressed = true;
            }

            if (dPadH == 0)
            {
                DPadHPressed = false;
            }
//--------------------------------------------------------
        }
        else
        {
            inputDisableElapsed -= Time.fixedDeltaTime;
            if (inputDisableElapsed < 0)
            {
                inputIsDisabled = false;
            }
        }
    }