示例#1
0
    public override void InputHandler()
    {
        Vector3 moveToward = new Vector3(
            Input.GetAxis("Horizontal"),
            0f,
            Input.GetAxis("Vertical"));

        if (moveToward.magnitude > float.Epsilon)
        {
            avatar.Move(moveToward);

            if (distanceDelta < 0.22f)
            {
                distanceDelta += moveToward.magnitude * avatar.speed;
            }
            else
            {
                // Dump moveAct, add new one and relink inpHandler
                Confirmed = true;
                ChangeStateTo_NewMoveAct();
            }
            return;
        }
        else
        {
            //avatar.anim.SetFloat("Velocity", 0); // temp in here
        }

        Timer += Time.deltaTime;
    }
示例#2
0
    /// <summary>
    /// Update the specified dt.
    /// </summary>
    /// <param name="dt">Dt.</param>
    public override void Update(float dt)
    {
        Vector2 movementVector = Vector2.zero;

        movementVector.x = Util.Sign(Input.GetAxis(horizontalMoveAxis));
        movementVector.y = Util.Sign(Input.GetAxis(verticalMoveAxis));
        //Debug.Log (horizontalMoveAxis + " : " + Input.GetAxis (horizontalMoveAxis));
        //Debug.Log ("movement vector: " + movementVector.ToString ());
        bool focus  = Input.GetButton(focusButton);
        bool fire   = Input.GetButton(fireButton);
        bool charge = Input.GetButton(chargeButton);

        PlayerAvatar.Move(movementVector.x, movementVector.y, focus, dt);
        if (fire)
        {
            PlayerAvatar.StartFiring();
        }
        else
        {
            PlayerAvatar.StopFiring();
        }

        if (charge)
        {
            PlayerAvatar.StartCharging();
        }
        else if (PlayerAvatar.CurrentChargeLevel != 0)
        {
            PlayerAvatar.ReleaseCharge();
        }
    }
示例#3
0
 public void MovePosition(Vector2 position)
 {
     position.x = Mathf.Clamp(position.x, m_playerData.m_moveArea.x, m_playerData.m_moveArea.width);
     position.y = Mathf.Clamp(position.y, m_playerData.m_moveArea.height, m_playerData.m_moveArea.y);
     if (m_avatar != null)
     {
         m_avatar.Move(position);
     }
 }
示例#4
0
    public void Move()
    {
        float moveX = Input.GetAxis("Horizontal");
        float moveY = Input.GetAxis("Vertical");

        float turn = Input.GetAxis("RightCrossX");

        _player.Move(new Vector3(moveX, moveY, 0).normalized, turn);
    }