예제 #1
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();
        }
    }