예제 #1
0
    public override void Update(IM.Number fDeltaTime)
    {
        if (match.m_stateMachine.m_curState.m_eState != MatchState.State.ePlaying)
        {
            return;
        }

        if (targetPoint != null && match.level != GameMatch.Level.Easy)
        {
            //m_bForceNotRush = CanArriveBeforePlayer(new IM.Vector3(targetPoint.transform.position));
            m_bForceNotRush = CanArriveBeforePlayer(match.curPointPosition);
        }
        else
        {
            m_bForceNotRush = false;
        }

        base.Update(fDeltaTime);

        if (targetPoint != match.curPoint)
        {
            m_moveTarget         = m_player.position;
            targetPoint          = null;
            timerTracePoint.stop = true;
        }

        timerTracePoint.Update(fDeltaTime);
    }
예제 #2
0
    public override void GameUpdate(IM.Number deltaTime)
    {
        base.GameUpdate(deltaTime);

        if (m_stateMachine.m_curState != null && m_stateMachine.m_curState.m_eState == MatchState.State.ePlaying)
        {
            timerSwitchRole.Update(deltaTime);
        }
        if (timerOver != null)
        {
            timerOver.Update(deltaTime);
        }
        if (timerSwitchRoleDelay != null)
        {
            timerSwitchRoleDelay.Update(deltaTime);
        }
        if (timerBoard != null)
        {
            gameMatchTime = timerSwitchRole.Remaining();
        }

        if (switchRoleOnShootOver && mCurScene.mBall.m_ballState == BallState.eLoseBall)
        {
            SwitchRole();
            timerSwitchRole.SetTimer(OFFENSE_TIME_LIMIT);
            timerSwitchRole.stop  = false;
            switchRoleOnShootOver = false;
        }
    }
예제 #3
0
    virtual public void Update(IM.Number fDeltaTime)
    {
        if (m_match.level != GameMatch.Level.None)
        {
            bool bRush = false;
            if (m_match.m_stateMachine.m_curState.m_eState == MatchState.State.eBegin)
            {
                bRush = false;
            }

            if (m_bForceNotRush)
            {
                bRush = false;
            }
            else
            {
                if (m_player.m_stamina.m_curRatio >= m_match.gameMode.rushStamina)
                {
                    bRush = true;
                }
                else if (m_player.m_stamina.m_curRatio < new IM.Number(0, 010))
                {
                    bRush = false;
                }
            }
            m_player.m_moveType = bRush ? MoveType.eMT_Rush : MoveType.eMT_Run;
        }

        m_timerTick.Update(fDeltaTime);
    }
예제 #4
0
    public override void GameUpdate(IM.Number deltaTime)
    {
        base.GameUpdate(deltaTime);

        if (m_bTimeUp)
        {
            npc.m_aiMgr.m_enable = false;
        }

        if (m_stateMachine.m_curState != null && m_stateMachine.m_curState.m_eState == MatchState.State.ePlaying && refreshTimeNum == 0)
        {
            timer = new GameUtils.Timer(refresh_infos[0].interval, RefreshBalls);
        }

        //If there is no ball in the scene, or the only ball is hold by main player.
        //TODO 针对PVP修改
        if ((mCurScene.balls.Count == 0 || (mCurScene.balls.Count == 1 && mainRole.m_bWithBall)) &&
            refreshTimeNum == refresh_infos.Count)
        {
            refreshTimeNum = 0;
            RefreshBalls();
        }

        if (timer != null)
        {
            timer.Update(deltaTime);
        }
    }
예제 #5
0
    override public void Update(IM.Number fDeltaTime)
    {
        if (prNoMove != null)
        {
            prNoMove.Update(fDeltaTime);
        }

        if (m_bFrozen)
        {
            return;
        }

        if (m_player.m_team.m_role != GameMatch.MatchRole.eOffense)
        {
            m_stateMachine.SetState(PlayerState.State.eStand);
            return;
        }

        if (m_bOnCollide)
        {
            if (!m_player.animMgr.IsPlaying(m_curAction))
            {
                m_stateMachine.SetState(PlayerState.State.eStand);
                return;
            }
        }
        else if (m_player.m_toSkillInstance == null)
        {
            m_stateMachine.SetState(PlayerState.State.eStand);
            return;
        }
    }
    public override void GameUpdate(IM.Number deltaTime)
    {
        base.GameUpdate(deltaTime);
        _RefreshAOD();

        timerReset.Update(deltaTime);
        timerOver.Update(deltaTime);
    }
예제 #7
0
    override public void Update(IM.Number fDeltaTime)
    {
        base.Update(fDeltaTime);

        if (behaviour.in_tutorial && behaviour.step != PractiseBehaviourRebound.Step.Shoot)
        {
            m_system.SetTransaction(AIState.Type.ePractiseRebound_Idle);
        }
        timer.Update(fDeltaTime);
    }
    public override void GameUpdate(IM.Number deltaTime)
    {
        base.GameUpdate(deltaTime);

        if (uiMatch != null)
        {
            if (m_stateMachine.m_curState != null && m_stateMachine.m_curState.m_eState == MatchState.State.ePlaying)
            {
                m_gameMatchCountStop = false;
            }
            else
            {
                m_gameMatchCountStop = true;
            }
        }

        if (firstTime &&
            m_stateMachine.m_curState != null && m_stateMachine.m_curState.m_eState == MatchState.State.ePlaying &&
            !npc.m_bWithBall && npc.m_StateMachine.m_curState.m_eState == PlayerState.State.eStand)
        {
            FetchBall(npc);
            firstTime = false;
        }

        /*
         * if (blocked && npc.m_StateMachine.m_curState.m_eState == PlayerState.State.eStand)
         *      Refresh();
         * if (m_mainRole.m_bWithBall && m_mainRole.m_StateMachine.m_curState.m_eState == PlayerState.State.eStand)
         * {
         *      UBasketball ball = m_mainRole.m_ball;
         *      m_mainRole.DropBall(ball);
         *      mCurScene.DestroyBall(ball);
         *      Refresh();
         * }
         */

        if (timerRefresh != null)
        {
            timerRefresh.Update(deltaTime);
        }

        if (m_stateMachine.m_curState != null && m_stateMachine.m_curState.m_eState == MatchState.State.eOver)
        {
            NGUITools.SetActive(ballConveyor, false);
        }

        //添加倒计时相关的代码
        if (m_gameMathCountTimer != null && !m_gameMatchCountStop && m_gameMathCountEnable)
        {
            if (uiMatch != null)
            {
                uiMatch.timerBoard.UpdateTime((float)m_gameMathCountTimer.Remaining());
            }
        }
    }
예제 #9
0
    override public void GameUpdate(IM.Number fDeltaTime)
    {
        base.GameUpdate(fDeltaTime);
        mTimer.Update(fDeltaTime);
        mTimerSound.Update(fDeltaTime);

        if (counterDone && m_match.mCurScene.mBall.m_ballState != BallState.eRebound)
        {
            _OnEnableTipOff();
        }
    }
    override public void GameUpdate(IM.Number fDeltaTime)
    {
        base.GameUpdate(fDeltaTime);

        if (timerBegin != null)
        {
            timerBegin.Update(fDeltaTime);
        }
        if (timerEnd != null)
        {
            timerEnd.Update(fDeltaTime);
        }
    }
예제 #11
0
    public void FixedUpdate(float fDeltaTime)
    {
        if (!m_init)
        {
            return;
        }

        m_curTime += fDeltaTime;
        if (m_timer != null)
        {
            m_timer.Update(fDeltaTime);
        }
    }
예제 #12
0
    public override void Update(IM.Number fDeltaTime)
    {
        base.Update(fDeltaTime);

        CastSkill();

        if (m_player.m_bWithBall)
        {
            Exit();
        }
        else if (m_player.m_StateMachine.m_curState.m_eState == PlayerState.State.ePickAndRoll &&
                 (m_player.m_StateMachine.m_curState as PlayerState_PickAndRoll).m_bOnCollide)
        {
            Exit();
        }

        timer.Update(fDeltaTime);
    }
    override public void Update(IM.Number fDeltaTime)
    {
        UBasketball ball = m_match.mCurScene.mBall;

        if (ball != null && ball.m_owner == null && ball.m_ballState != BallState.eUseBall_Pass)
        {
            m_system.SetTransaction(AIState.Type.ePractisePass_TraceBall);
            return;
        }

        if (m_player.m_bWithBall &&
            (!behaviour.in_tutorial || m_match.mainRole.m_StateMachine.m_curState.m_eState == PlayerState.State.eRequireBall))
        {
            m_system.SetTransaction(AIState.Type.ePractisePass_Pass);
        }

        m_timer.Update(fDeltaTime);
    }
예제 #14
0
    /*
     * public override void FixedUpdate ()
     * {
     *      if( m_mainRole == null || npc == null )
     *              return;
     *
     *      if( mCurScene == null )
     *              return;
     *
     *      Vector3 curPos = m_mainRole.position;
     *      mCurScene.mGround.BoundInZone(ref curPos);
     *      m_mainRole.position = curPos;
     *
     *      curPos = npc.position;
     *      mCurScene.mGround.BoundInZone(ref curPos);
     *      npc.position = curPos;
     * }
     */

    public override void GameUpdate(IM.Number deltaTime)
    {
        base.GameUpdate(deltaTime);

        if (m_bTimeUp)
        {
            npc.m_aiMgr.m_enable = false;
        }

        //LimitPlayer(m_mainRole);
        //LimitPlayer(npc);

        //foreach (UBasketball ball in mCurScene.balls)
        //	LimitBall(ball);

        if (timer != null)
        {
            timer.Update(deltaTime);
        }
    }
예제 #15
0
    public override void Update(IM.Number fDeltaTime)
    {
        if (match.currBall != null && match.currBall != targetBall)
        {
            targetBall            = match.currBall;
            targetBall.onRebound += OnRebound;
            targetBall.onGrab    += OnGrab;
        }

        if (match.currBall != null && match.currBall.m_ballState == BallState.eRebound)
        {
            //TODO: rebound skill distance involoved

            /*
             * if (GameUtils.HorizonalDistance(m_player.position, match.currBall.transform.position) > m_player.m_fReboundDist)
             * {
             *      Vector3 vMoveTarget = match.currBall.transform.position;
             *      vMoveTarget.y = 0.0f;
             *      m_moveTarget = vMoveTarget;
             * }
             */
        }
        else
        {
            IM.Vector3 vMoveTarget = match.mCurScene.mBasket.m_vShootTarget;
            vMoveTarget.y = IM.Number.zero;
            m_moveTarget  = vMoveTarget;
        }

        base.Update(fDeltaTime);

        if (timerRebound != null)
        {
            timerRebound.Update(fDeltaTime);
        }
    }
예제 #16
0
    override public void Update(IM.Number fDeltaTime)
    {
        base.Update(fDeltaTime);

        if (m_player.CanRebound(m_ball) && (timerRebound == null || timerRebound.stop))
        {
            //Debug.Log("Rebound info of " + m_player.m_name);
            ReboundAttrConfig.ReboundAttr attr = GameSystem.Instance.ReboundAttrConfigData.GetReboundAttr(m_player.m_position);
            if (attr == null)
            {
                Debug.LogError("Rebound height config error.");
            }

            ShootSolution.SShootCurve curve = m_ball.CompleteLastCurve();
            IM.Number ballHeight            = m_ball.position.y;
            ballHeight *= (IM.Number.one - m_system.AI.devBallHeight);
            if (ballHeight >= attr.minHeight)
            {
                //Debug.Log("Rebound max height: " + attr.maxHeight +" Ball height: " + ballHeight + " Rebound height scale: " + attr.reboundHeightScale + " Ball height scale: " + attr.ballHeightScale);
                IM.Number npcReboundBallHeight = AIUtils.GetNPCReboundBallHeight(attr.maxHeight, ballHeight, attr.reboundHeightScale, attr.ballHeightScale);
                //Debug.Log("NPC rebound ball height: " + npcReboundBallHeight);
                IM.Number time1, time2;
                curve.GetTimeByHeight(npcReboundBallHeight, out time1, out time2);
                IM.Number ballFlyTime = time2;
                //Debug.Log("Ball fly time: " + ballFlyTime);
                if (ballFlyTime < -new IM.Number(0, 1))
                {
                    Debug.LogError("Ball fly time error.");
                }

                SkillInstance basicRebound  = m_player.m_skillSystem.GetBasicSkillsByCommand(Command.Rebound)[0];
                string        basicActionId = basicRebound.skill.actions[0].action_id;
                IM.Number     frameRate     = m_player.animMgr.GetFrameRate(basicActionId);
                Dictionary <string, PlayerAnimAttribute.AnimAttr> rebounds = m_player.m_animAttributes.m_rebound;
                int       reboundKey        = rebounds[m_player.animMgr.GetOriginName(basicActionId)].GetKeyFrame("OnRebound").frame;
                IM.Number reboundActionTime = reboundKey / frameRate;

                IM.Number reboundDelayTime = ballFlyTime - m_ball.m_fTime - reboundActionTime;
                //Debug.Log("Rebound delay time: " + reboundDelayTime);
                if (reboundDelayTime < IM.Number.zero)
                {
                    reboundDelayTime = IM.Number.zero;
                }
                timerRebound.SetTimer(reboundDelayTime);
                timerRebound.stop = false;

                return;
            }
        }

        if (m_ball.m_owner != null)
        {
            m_system.SetTransaction(AIState.Type.eIdle);
        }
        else
        {
            IM.Vector3 vMoveTarget = m_ball.position;
            if (m_ball.m_ballState == BallState.eUseBall_Shoot)
            {
                vMoveTarget = m_match.mCurScene.mBasket.m_vShootTarget;
            }
            vMoveTarget.y       = IM.Number.zero;
            m_moveTarget        = vMoveTarget;
            m_player.m_moveType = fogs.proto.msg.MoveType.eMT_Rush;

            if (m_ball.m_ballState == BallState.eLoseBall &&
                (m_player.m_position == PositionType.PT_PG || m_player.m_position == PositionType.PT_SG))
            {
                IM.Vector3 ballPos    = m_ball.position;
                IM.Number  distToBall = GameUtils.HorizonalDistance(ballPos, m_player.position);
                if (distToBall < PlayerState_BodyThrowCatch.GetMaxDistance(m_player) && ballPos.y <= IM.Number.one)
                {
                    m_system.SetTransaction(AIState.Type.eBodyThrowCatch);
                }
            }
        }

        if (timerRebound != null)
        {
            timerRebound.Update(fDeltaTime);
        }
    }
예제 #17
0
    public override void GameUpdate(IM.Number deltaTime)
    {
        base.GameUpdate(deltaTime);

        if (m_stateMachine.m_curState.m_eState != MatchState.State.eOpening && m_stateMachine.m_curState.m_eState != MatchState.State.eOverTime)
        {
            curTipCD -= (float)deltaTime;
            if (timer != null)
            {
                timer.Update(deltaTime);
            }
        }

        if (m_stateMachine.m_curState.m_eState != MatchState.State.ePlaying)
        {
            return;
        }

        matchReviseTip.Update((float)deltaTime);

        if (mainRole.m_StateMachine.m_curState.m_eState == PlayerState.State.eHold && mainRole.m_bMovedWithBall)
        {
            ShowGuide("HoldLock");
        }

        if (!(mainRole.m_StateMachine.m_curState is PlayerState_Skill) &&
            !m_ruler.m_bToCheckBall &&
            mainRole.m_bWithBall && mainRole.m_bOnGround)
        {
            bool isMainRoleDefended = mainRole.IsDefended();
            if (isMainRoleDefended)
            {
                if (mainRole.m_position == PositionType.PT_C || mainRole.m_position == PositionType.PT_PF)
                {
                    //if (completedGuide.Contains("Clutch") && !clutchGuiding)
                    ShowGuide("CrossOver", 4);
                    //else
                    //{
                    //	ShowGuide("Clutch", 5);
                    //	clutchGuiding = true;
                    //}
                }
                else
                {
                    ShowGuide("CrossOver", 4);
                }
            }
            else
            {
                ShowGuide("Undefended", 1);
            }
        }
        else
        {
            clutchGuiding = false;
        }

        if (mCurScene.mBall.m_ballState == BallState.eLoseBall &&
            mainRole.m_bOnGround &&
            (mainRole.m_position == PositionType.PT_PG || mainRole.m_position == PositionType.PT_SG))
        {
            IM.Number catchDistance = PlayerState_BodyThrowCatch.GetMaxDistance(mainRole);
            IM.Number curDistance   = GameUtils.HorizonalDistance(mainRole.position, mCurScene.mBall.position);
            if (curDistance <= catchDistance)
            {
                ShowGuide("BodyThrowCatch", 1);
            }
        }

        if (mainRole.m_defenseTarget.m_bWithBall &&
            mainRole.m_defenseTarget.m_AOD.GetStateByPos(mainRole.position) != AOD.Zone.eInvalid)
        {
            if (GameSystem.Instance.StealConfig.GetRatio(mainRole.m_defenseTarget.m_StateMachine.m_curState.m_eState) > IM.Number.zero)
            {
                ShowGuide("Steal", 4);
            }
            else if (AIUtils.CanBlock(mainRole, mainRole.m_defenseTarget, IM.Number.zero, IM.Number.zero, mCurScene.mBasket.m_vShootTarget))
            {
                if (mainRole.m_defenseTarget.m_StateMachine.m_curState.m_eState != PlayerState.State.ePrepareToShoot)
                {
                    ShowGuide("Block", 1);
                }
            }
        }

        if (mCurScene.mBall.m_ballState == BallState.eRebound)
        {
            IM.Number fDistPlayer2Ball = GameUtils.HorizonalDistance(mainRole.position, mCurScene.mBall.position);
            if (fDistPlayer2Ball <= mainRole.m_fReboundDist)
            {
                IM.Number  minHeight      = new IM.Number(1, 6);
                IM.Number  maxHeight      = mainRole.m_finalAttrs["rebound_height"] * new IM.Number(0, 13) + new IM.Number(3);
                IM.Number  ball_height    = mCurScene.mBall.position.y;
                bool       inReboundRange = minHeight < ball_height && ball_height < maxHeight;
                IM.Vector3 velocity       = mCurScene.mBall.curVel;
                if (velocity.y < IM.Number.zero && inReboundRange)
                {
                    ShowGuide("Rebound", 1);
                }
            }
        }
    }
예제 #18
0
 public override void GameUpdate(IM.Number fDeltaTime)
 {
     base.GameUpdate(fDeltaTime);
     _timer.Update(fDeltaTime);
 }