Esempio n. 1
0
    private void Swing()
    {
        self = BattleM.SelfSel;
        var varWnd = WndManager.FindWnd <MineBallSpinWnd>();

        if (m_swingInfo != null)
        {
            float offset = (m_move.transform.localEulerAngles.z - 180 + 40) / 80 * 100;
            if (offset < 0)
            {
                offset = 0;
            }
            else if (offset > 99)
            {
                offset = 100;
            }
            ClubparameterConfig clubConfig = ClubparameterDao.Inst.GetCfg((uint)self.Club.Type);
            if (BattleM.BallInAra == AreaType.PuttingGreen)
            {
                m_swingInfo.CurAccuracyOffset = 0;
                if (clubConfig != null)
                {
                    m_swingInfo.BattingSpeed = MathUtil.RotateRound(BattleM.GetRollSpeedDir() * clubConfig.MinDistance, m_dragPower, m_ballAngle);
                }
                m_swingInfo.CurHookAngle = m_greenAngle;
            }
            else
            {
                m_swingInfo.CurHookAngle      = m_ballAngle;
                m_swingInfo.CurAccuracyOffset = 50 - offset;
                m_swingInfo.BattingSpeed      = self.NeedSpeed * m_dragPower;
            }


            m_swingInfo.Ball = self.Ball;
            m_swingInfo.Club = self.Club;



            //m_swingInfo.WindSpeed ;
            if (varWnd != null)
            {
                m_swingInfo.CurFBSpin = varWnd.m_CurFBSpin;
                //self.Club.BackSpin = varWnd.m_underSpin;
                m_swingInfo.CurLRSpin = varWnd.m_LRspin;

                //Debug.Log(m_swingInfo.m_dragAngle+".."+ m_swingInfo.m_downSpin+".."+ m_swingInfo.m_upSpin+"..." + m_swingInfo.m_leftSpin+"..."+ m_swingInfo.m_rightSpin);
                // Destroy(varWnd);
            }
            else
            {
                m_swingInfo.CurFBSpin = 0;
                m_swingInfo.CurLRSpin = 0;
            }

            movingValue = m_dragGolfPos;
            dragDis     = Vector3.Distance(m_golfPos, m_dragGolfPos);
            if (m_GolfboxOut != null && m_GolfboxIn != null)
            {
                outScale = m_GolfboxOut.transform.localScale.x;
                inScale  = m_GolfboxIn.transform.localScale.x;
                DOTween.To(() => outScale, x => outScale = x, 0.8f, 0.1f).OnComplete(() =>
                {
                    m_GolfboxOut.SetActive(false);
                });
                DOTween.To(() => inScale, x => inScale = x, 0.6f, 0.1f).OnComplete(() =>
                {
                    m_GolfboxIn.SetActive(false);
                });
            }
            DOTween.To(() => movingValue, x => movingValue = x, m_golfPos, 0.1f);

            isDrag = true;
            WndManager.DestoryWnd <SwingModeWnd>(0.2f);
            WndManager.DestoryWnd <BattleMainWnd>(0.2f);
        }
        BattleM.SetBattleStatus(BattleStatus.Round_FireBall, m_swingInfo);
    }