示例#1
0
 public void AddScore(int id, int score)
 {
     if (_scores.Count > id)
     {
         _scores[id].ScoreValue += score;
         UpdateTextValues();
         if (_doResetOnScore)
         {
             _ball.ResetBall();
         }
     }
     else
     {
         Debug.LogWarning("Error: No score with ID: " + id + " found!");
     }
 }
    // Update is called once per frame
    void Update()
    {
        if (scoreCom.GamePause == false)
        {
            if (Input.GetKey(LeftKeyCode) == true)
            {
                _moveParameter(false);
            }
            else if (Input.GetKey(RightKeyCode) == true)
            {
                _moveParameter(true);
            }
            else if (Input.GetKeyUp(AdjustRadius) == true)
            {
                if (m_bPenaltyPlayer == true)
                {
                    ballMove.ResetBall(PlayerOwnState, transform);
                    m_bPenaltyPlayer = false;
                }
                else
                {
                    if (rotationRadius == BigRadius)
                    {
                        rotationRadius = SmallRadius;
                        _changePos();
                    }
                    else
                    {
                        rotationRadius = BigRadius;
                        _changePos();
                    }
                }
            }
            if (Input.GetKey(StickMoveKeyCode) == true)
            {
                //m_animatorStick.Play("stickMove");
                //m_animatorStick.enabled = true;
                if (m_bRotateZ == false && m_bStickDown == false)
                {
                    m_bRotateZ        = true;
                    m_bStickDown      = true;
                    m_fCurRotateZTime = 0;
                }
            }
            if (Input.GetKeyUp(StickMoveKeyCode) == true)
            {
                _resetAngle();
            }

            if (m_bRotateZ == true)
            {
                if (m_bStickDown == true)
                {
                    m_fCurRotateZTime += Time.deltaTime;
                    if (m_fCurRotateZTime >= RotateZTime)
                    {
                        m_bRotateZ      = false;
                        m_fRotateZValue = 0;
                    }
                    else
                    {
                        m_fRotateZValue += (Time.deltaTime * RotateZSpeed);
                        Vector3 vec = new Vector3(0, 0, m_fRotateZValue);
                        transform.Rotate(vec, Space.Self);
                    }
                }
            }

            //if(m_animatorStick.enabled == true)
            //{
            //    if (m_animatorStick.GetCurrentAnimatorStateInfo(0).normalizedTime > 1 && !m_animatorStick.IsInTransition(0))
            //    {
            //        if (m_animatorStick.GetCurrentAnimatorStateInfo(0).shortNameHash == m_hashNameStickMove)
            //        {
            //            m_animatorStick.enabled = false;
            //        }
            //    }
            //}
        }
        else
        {
            if (Input.GetKey(LeftKeyCode) || Input.GetKey(RightKeyCode))
            {
                //角色确认
                scoreCom.PlayerConfirm(PlayerOwnState);
            }
        }
    }