Example #1
0
    public override void InitBallHolder()
    {
        UBasketball ball = mCurScene.mBall;

        if (ball != null && ball.m_owner != null)
        {
            ball.m_owner.DropBall(ball);
        }
        if (ball != null)
        {
            ball.Reset();
        }

        if (m_offenseTeam.GetMemberCount() != 0)
        {
            Player offenserWithBall = m_offenseTeam.GetInitialBallHolder();
            offenserWithBall.GrabBall(ball);
            offenserWithBall.m_StateMachine.SetState(PlayerState.State.eHold);
            SwitchMainrole(offenserWithBall);
            SwitchMainrole(offenserWithBall.m_defenseTarget);
        }
    }
    public override void InitBallHolder()
    {
        UBasketball ball = mCurScene.mBall;

        if (ball != null && ball.m_owner != null)
        {
            ball.m_owner.DropBall(ball);
        }
        if (ball != null)
        {
            ball.Reset();
        }

        if (m_offenseTeam.GetMemberCount() != 0)
        {
            Player offenserWithBall = m_offenseTeam.GetMember(0);
            //if (m_offenseTeam == m_homeTeam)
            //	offenserWithBall = m_mainRole;
            offenserWithBall.GrabBall(ball);
            offenserWithBall.m_StateMachine.SetState(PlayerState.State.eHold);
        }
    }
Example #3
0
    override public void OnEnter(MatchState lastState)
    {
        if (m_match.m_needTipOff)
        {
            TipOffPos tipOffPos = GameSystem.Instance.MatchPointsConfig.TipOffPos;
            int       homeCnt   = m_match.m_homeTeam.GetMemberCount();
            for (int idx = 0; idx != homeCnt; idx++)
            {
                IM.Transform trOffensePos = tipOffPos.offenses_transform[idx];
                IM.Transform trDefensePos = tipOffPos.defenses_transform[idx];
                Player       homePlayer   = m_match.m_homeTeam.members[idx];
                if (homePlayer != null)
                {
                    homePlayer.position = trOffensePos.position;
                    homePlayer.rotation = trOffensePos.rotation;
                }
                Player awayPlayer = m_match.m_awayTeam.members[idx];
                if (awayPlayer != null)
                {
                    awayPlayer.position = trDefensePos.position;
                    awayPlayer.rotation = trDefensePos.rotation;
                }
            }
            m_match.m_needTipOff = false;
        }

        if (m_match.m_cam != null)
        {
            m_match.m_cam.m_Zoom.ReleaseZoom();
        }

        foreach (Player player in GameSystem.Instance.mClient.mPlayerManager)
        {
            player.m_enableAction   = false;
            player.m_enableMovement = false;
            player.m_bMovedWithBall = false;

            if (player.m_catchHelper != null)
            {
                player.m_catchHelper.enabled = true;
            }

            if (player.m_pickupDetector != null)
            {
                player.m_enablePickupDetector = true;
            }

            if (player.m_AOD != null)
            {
                player.m_AOD.visible = false;
            }

            player.m_toSkillInstance = null;
            player.m_stamina.ResetStamina();

            player.m_StateMachine.SetState(PlayerState.State.eStand);
        }

        if (m_goBeginUI == null)
        {
            m_goBeginUI = GameSystem.Instance.mClient.mUIManager.CreateUI("UIBeginCounter");
        }
        if (m_goBeginUI == null)
        {
            Debug.Log("Error -- can not find ui resource " + "UIBeginCounter");
            return;
        }
        Animation anim = m_goBeginUI.GetComponentInChildren <Animation>();

        anim.Stop();
        anim.Play("counter");

        UBasketball ball = m_match.mCurScene.mBall;

        if (ball != null && ball.m_owner != null && m_match.m_uiMatch != null && m_match.EnableCounter24())
        {
            m_match.m_uiMatch.ShowCounter(true, ball.m_owner.m_team.m_side == Team.Side.eHome);
            m_match.m_count24TimeStop = true;
        }

        ball.Reset();
        IM.Number x1 = m_match.m_homeTeam.members[0].position.x;
        IM.Number x2 = m_match.m_awayTeam.members[0].position.x;
        IM.Number z  = m_match.m_homeTeam.members[0].position.z;
        ball.SetInitPos(new IM.Vector3((x1 + x2) * IM.Number.half, fBallInitHeight, z));
        ball.m_ballState = BallState.eNone;

        if (m_match.m_uiMatch != null && m_match.EnableCounter24())
        {
            m_match.m_uiMatch.ShowCounter(true, true);

            m_match.m_gameMatchCountStop = true;
            m_match.m_count24TimeStop    = true;
        }

        if (m_match.EnableEnhanceAttr())
        {
            m_match.EnhanceAttr();
        }

        mTimer      = new GameUtils.Timer(new IM.Number(3), _OnCounterDone, 1);
        mTimerSound = new GameUtils.Timer(new IM.Number(3), PlaySound, 1);

        m_match.m_homeTeam.m_role         = GameMatch.MatchRole.eNone;
        m_match.m_awayTeam.m_role         = GameMatch.MatchRole.eNone;
        m_match.m_ruler.m_toCheckBallTeam = null;
    }