Beispiel #1
0
    IEnumerator _heroAction()
    {
        Hero activeHero = battleOrder.ActiveHero(currentTurn);

        if (!activeHero.isDead)
        {
            switch (activeHero.allyOrEnemy)
            {
            case AllyOrEnemy.Ally:
                activeHero.Action(enemies);
                break;

            case AllyOrEnemy.Enemy:
                activeHero.Action(allies);
                break;
            }

            while (activeHero.heroState == HeroState.Attacking)
            {
                yield return(null);
            }
        }

        nextTurn();
        currentState = BattleState.HeroAction;

        if (!activeHero.isDead)
        {
            DamageCheck();
        }
    }
Beispiel #2
0
    void FixedUpdate()
    {
        if (!hero.IsActive)
        {
            hero.StopWalk();
            if (_changeHeroButtonPressed)
            {
                hero.ChangeHero();
            }
            DeactivateTriggerButtons();
            return;
        }

        if (_crouchButtonPressed)
        {
            hero.Crouch();
        }
        else
        {
            hero.StandUp();
        }

        if (_carryButtonPressed)
        {
            hero.Carry();
        }
        else
        {
            hero.StopCarry();
        }

        if (_changeHeroButtonPressed)
        {
            hero.ChangeHero();
            SoundManager.Instance.SendMessage("PlaySFXSwap");
        }

        if (_jumpButtonPressed)
        {
            hero.Jump();
        }

        if (_actionButtonPressed)
        {
            hero.Action();
        }

        if (Mathf.Abs(_moveButtonSpeed) > HeroControl.MOVE_THRESHOLD)
        {
            hero.Move(_moveButtonSpeed);
        }
        else
        {
            hero.Move(0.0f);
        }

        DeactivateTriggerButtons();
    }
Beispiel #3
0
    // Its called once per frame
    public void ProcessHeroInput(game_input GameInput)
    {
        if (!hero.IsActive)
        {
            return;
        }

        if (GameInput.crouch)
        {
            hero.Crouch();
        }
        else
        {
            hero.StandUp();
        }

        if (GameInput.carry)
        {
            hero.Carry();
        }
        else
        {
            hero.StopCarry();
        }

        if (GameInput.jump)
        {
            hero.Jump();
        }

        if (GameInput.action)
        {
            hero.Action();
        }

        if (Mathf.Abs(GameInput.horizontalAxis) > HeroControl.MOVE_THRESHOLD)
        {
            hero.Move(GameInput.horizontalAxis);
        }
        else
        {
            hero.Move(0.0f);
        }
        if (Mathf.Abs(GameInput.verticalAxis) > HeroControl.MOVE_THRESHOLD)
        {
            hero.VerticalMove(GameInput.verticalAxis);
        }
        else
        {
            hero.VerticalMove(0.0f);
        }

        if (GameInput.verticalAxis != 0)
        {
            hero.CarryBox();
        }
    }
    void FixedUpdate()
    {
        if (!hero.IsActive)
        {
            hero.StopWalk();
            DeactivateTriggerButtons();
            return;
        }

        if (_crouchButtonPressed)
        {
            hero.Crouch();
        }
        else
        {
            hero.StandUp();
        }

        if (_carryButtonPressed)
        {
            hero.Carry();
        }
        else
        {
            hero.StopCarry();
        }

        if (_jumpButtonPressed)
        {
            hero.Jump();
        }

        if (_actionButtonPressed)
        {
            hero.Action();
        }

        if (Mathf.Abs(_moveButtonSpeed) > HeroControl.MOVE_THRESHOLD)
        {
            hero.Move(_moveButtonSpeed);
        }
        else
        {
            hero.Move(0.0f);
        }
        if (Mathf.Abs(_verticalMoveButtonSpeed) > HeroControl.MOVE_THRESHOLD)
        {
            hero.VerticalMove(_verticalMoveButtonSpeed);
        }
        else
        {
            hero.VerticalMove(0.0f);
        }

        DeactivateTriggerButtons();
    }
Beispiel #5
0
//  ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
    // Update is called once per frame
    void Update()
    {
        // Recebe a input
        _input.Set(/*Input.GetAxis("Xbox RHorizontal")*/ InputManager.GetSelectorHorizontalAxis(),
                   /*Input.GetAxis("Xbox RVertical")*/ InputManager.GetSelectorVerticalAxis()); // Isso aqui precisa vir do GameManager.
        if (_input.sqrMagnitude > 0.0f)
        {
            // Calcula a direção do input, considerando a perspectiva isométrica.
            _input = Vector2.ClampMagnitude(_input, 1f);
            Vector2 isometricInput = new Vector2(_input.x + _input.y, _input.y - _input.x);

            // Calcula movimento e direção.
            //isometricInput *= Time.deltaTime * movimentSpeed;
            Vector3 direction = Quaternion.Euler(30.0f, 45.0f, 0.0f) * new Vector3(_input.x, 0f, _input.y);
            direction *= Time.deltaTime * movimentSpeed;
            //direction.y = SelectorRaycaster.surfaceHeight;

            //_selector.Translate(direction, Space.World);
            //_selector.position = ClampScreenPosition(_selector.position);

            // Aplica o movimento.

            //direction = ClampToScreen(direction);
            direction   = ClampToScreen(direction); // Este aqui tirar...
            direction.y = (SelectorRaycaster.surfaceHeight - direction.y);
            _selector.Translate(direction, Space.World);
            Vector3 temp = _selector.position;
            if (temp.y < 0f)
            {
                temp.y = 0;
            }
            _selector.position = temp;

            //_selector.Translate(direction, Space.World);
        }
        _leftTrigger  = /*Input.GetAxis("Xbox RLTrigger") < 0.0f*/ InputManager.GetCancelTrigger();
        _rightTrigger = /*Input.GetAxis("Xbox RLTrigger") > 0.0f*/ InputManager.GetActionTrigger();

        if (_leftTrigger)
        {
        }
        if (_rightTrigger)
        {
            Hero.Action(_selector.position);
        }

        //Xbox RLTrigger
    }