void OnTimer()
 {
     if (AIUtils.CanPickAndRoll(m_player) != 1)
     {
         Exit();
     }
 }
Exemple #2
0
 protected override void OnTick()
 {
     //持球进攻
     if (m_player.m_bWithBall)
     {
         PlayerState.State state = m_player.m_StateMachine.m_curState.m_eState;
         if (m_match.m_ruler.m_bToCheckBall)                 //带出三分线
         {
             if (state == PlayerState.State.eStand ||
                 state == PlayerState.State.eRun ||
                 state == PlayerState.State.eRush ||
                 state == PlayerState.State.eHold)
             {
                 bool inTakeOver = false;
                 if (m_player.m_inputDispatcher != null)
                 {
                     inTakeOver = m_player.m_inputDispatcher.inTakeOver;
                 }
                 if (!inTakeOver)
                 {
                     Player passTarget = AIUtils.ChoosePassTargetCheckBall(m_player, m_match);
                     if (passTarget != null)
                     {
                         AI_Pass pass = m_system.GetState(Type.ePass) as AI_Pass;
                         pass.m_toPass = passTarget;
                         m_system.SetTransaction(pass);
                     }
                     else
                     {
                         m_system.SetTransaction(AIState.Type.eCheckBall);
                     }
                 }
                 else
                 {
                     m_system.SetTransaction(AIState.Type.eCheckBall);
                 }
             }
         }
         else
         {
             if (state == PlayerState.State.eStand ||
                 state == PlayerState.State.eRun ||
                 state == PlayerState.State.eRush)
             {
                 Offense();
             }
             else if (state == PlayerState.State.eHold)
             {
                 if ((m_match.mCurScene.mGround.GetArea(m_player) == Area.eNear ||
                      !m_player.IsDefended(m_system.AI.devAngleAttacker, m_system.AI.devDistAOD)) &&
                     arriveFirstTarget)
                 {
                     Offense();
                 }
                 else
                 {
                     m_system.SetTransaction(AIState.Type.eIdle);
                 }
             }
         }
     }
     else            //非持球进攻
     {
         //空切
         if (arriveFirstTarget && m_ball.m_owner != null && IM.Random.value < new IM.Number(0, 250) &&
             m_player.IsDefended(m_system.AI.devAngleAttacker, m_system.AI.devDistAOD))
         {
             //if( !(m_match is GameMatch_PVP) )
             m_system.SetTransaction(AIState.Type.eCutIn);
         }
         //要球
         else if (m_ball.m_owner != null && m_ball.m_owner.m_team == m_player.m_team && m_system.m_bNotDefended && !m_match.m_ruler.m_bToCheckBall)
         {
             //if( !(m_match is GameMatch_PVP) )
             m_system.SetTransaction(AIState.Type.eRequireBall);
         }
         //靠近球6米,追球
         else if (AIUtils.ShouldTraceBall(m_ball, m_player))
         {
             m_system.SetTransaction(AIState.Type.eIdle);
         }
         //挡拆
         else
         {
             int result = AIUtils.CanPickAndRoll(m_player);
             if (result == 1 && m_player.m_StateMachine.m_curState.IsCommandValid(Command.PickAndRoll))
             {
                 m_system.SetTransaction(AIState.Type.ePickAndRoll);
             }
             else if (result == 2)
             {
                 positionForPR = true;
                 m_system.SetTransaction(AIState.Type.ePositioning, new IM.Number(100), true);
             }
         }
     }
 }