private void SwitchRole()
 {
     //TODO 针对PVP修改
     GameMatch.MatchRole temp = mainRole.m_team.m_role;
     mainRole.m_team.m_role = npc.m_team.m_role;
     npc.m_team.m_role      = temp;
 }
Exemplo n.º 2
0
    override public void OnEnter(MatchState lastState)
    {
        m_homeTeamMatchRole = m_match.m_homeTeam.m_role;

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

        if (m_match.m_uiMatch != null)
        {
            m_match.m_gameMatchCountStop = true;
            m_match.m_count24TimeStop    = true;
        }
    }
Exemplo n.º 3
0
    void _UpdateSectorHolders(Player player)
    {
        GameMatch.MatchRole matchRole = player.m_team.m_role;

        int sectorColomns = RoadPathManager.Instance.m_AngleList.Count;
        int sectorRows    = RoadPathManager.Instance.m_DistanceList.Count;

        int iCurPlayerSection = RoadPathManager.Instance.CalcSectorIdx(player.position);

        if (iCurPlayerSection == -1)
        {
            return;
        }

        int iCurColomn = iCurPlayerSection % sectorColomns;
        int iCurRow    = iCurPlayerSection / sectorColomns;

        //Debug.Log("Column: " + iCurColomn + " Row:" + iCurRow);

        if (matchRole == GameMatch.MatchRole.eOffense)
        {
            foreach (Vector2 range in player.m_takenSectorRanges)
            {
                int iRangeColomn = iCurColomn + (int)range.x;
                int iRangeRow    = iCurRow + (int)range.y;
                //colomn invalid, bounds collided
                if (iRangeColomn >= sectorColomns || iRangeColomn < 0)
                {
                    continue;
                }
                //row invalid, bounds collided
                if (iRangeRow >= sectorRows || iRangeRow < 0)
                {
                    continue;
                }
                int iNewColIdx = iRangeRow * sectorColomns + iRangeColomn;
                RoadPathManager.Sector sector = RoadPathManager.Instance.m_Sectors[iNewColIdx];
                sector.holders.Add(player);
                m_takenSectors.Add(iNewColIdx);
            }
        }
        else
        {
            RoadPathManager.Sector sector = RoadPathManager.Instance.m_Sectors[iCurPlayerSection];
            sector.holders.Add(player);
            m_takenSectors.Add(iCurPlayerSection);
        }
    }
Exemplo n.º 4
0
 public Team(Side side)
 {
     m_side = side;
     m_role = GameMatch.MatchRole.eNone;
 }
Exemplo n.º 5
0
    public override void OnEvent(PlayerActionEventHandler.AnimEvent animEvent, Player sender, System.Object context)
    {
        if (m_match.m_stateMachine.m_curState != this)
        {
            return;
        }

        UBasketball ball = m_match.mCurScene.mBall;

        if (animEvent == PlayerActionEventHandler.AnimEvent.ePickupBall ||
            animEvent == PlayerActionEventHandler.AnimEvent.eRebound)
        {
            if (animEvent == PlayerActionEventHandler.AnimEvent.eRebound)
            {
                sender.mStatistics.success_rebound_times++;
                //Debug.Log("rebound");
            }
            else
            {
                PlaySoundManager.Instance.PlaySound(MatchSoundEvent.GrabBall);
            }

            m_match.m_b24TimeUp = false;

            if (sender.m_team.m_role == GameMatch.MatchRole.eDefense ||
                sender.m_team.m_role == GameMatch.MatchRole.eNone)
            {
                if (!m_match.m_b24TimeUp)
                {
                    GameMatch.MatchRole senderTeamRole = sender.m_team.m_role;

                    if (m_match.EnableSwitchRole())
                    {
                        m_match.m_ruler.SwitchRole();
                    }

                    foreach (Player player in GameSystem.Instance.mClient.mPlayerManager)
                    {
                        player.m_enableAction = true;
                    }

                    if (senderTeamRole == GameMatch.MatchRole.eDefense && m_match.EnableCheckBall())
                    {
                        m_match.m_ruler.m_toCheckBallTeam = m_match.m_offenseTeam;
                    }

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

        if (animEvent == PlayerActionEventHandler.AnimEvent.eBlock)
        {
            sender.mStatistics.success_block_times++;
            PlaySoundManager.Instance.PlaySound(MatchSoundEvent.Block);
            PlaySoundManager.Instance.PlaySound(MatchSoundEvent.BlockBall);
        }

        if (animEvent == PlayerActionEventHandler.AnimEvent.eShoot)
        {
            bool bOpenShoot = (bool)context;
            if (bOpenShoot)
            {
                m_match.ShowPlayerTip(sender, "gameInterface_tip_shots");
            }
        }

        if (animEvent == PlayerActionEventHandler.AnimEvent.ePass)
        {
            //if( ball.m_interceptor == null )
            //    ball.m_catcher.m_bToCatch = true;
            PlaySoundManager.Instance.PlaySound(MatchSoundEvent.PassBall);
        }

        if (animEvent == PlayerActionEventHandler.AnimEvent.eIntercepted)
        {
            if (m_match.m_ruler.m_bToCheckBall && sender.m_team.m_role == GameMatch.MatchRole.eDefense)
            {
                foreach (Player player in m_match.m_ruler.m_toCheckBallTeam)
                {
                    player.m_enableAction = true;
                }
                m_match.m_ruler.m_toCheckBallTeam = null;
            }
            PlaySoundManager.Instance.PlaySound(MatchSoundEvent.InterceptSuc);
        }

        if (animEvent == PlayerActionEventHandler.AnimEvent.eDunk)
        {
            //if (m_match.m_cam != null && m_match.m_cam.m_Shake != null)
            //	m_match.m_cam.m_Shake.AddCamShake(Vector3.one * 0.2f, 0.5f, m_match.m_cam.transform.position);
        }

        if (animEvent == PlayerActionEventHandler.AnimEvent.eSteal)
        {
            //steal get ball
            if (sender.m_bWithBall)
            {
                if (m_match.m_uiMatch != null && m_match.EnableCounter24())
                {
                    m_match.m_uiMatch.ShowCounter(true, sender.m_team.m_side == m_match.m_homeTeam.m_side);
                    m_match.m_count24TimeStop = false;
                }
            }
            PlaySoundManager.Instance.PlaySound(MatchSoundEvent.StealSuc);
            sender.mStatistics.success_steal_times++;
        }

        if (animEvent == PlayerActionEventHandler.AnimEvent.eStolen)
        {
        }

        if (animEvent == PlayerActionEventHandler.AnimEvent.eCatch)
        {
            if (sender.m_defenseTarget != null)
            {
                if (sender.m_AOD.GetStateByPos(sender.m_defenseTarget.position) != AOD.Zone.eInvalid)
                {
                    m_match.ShowTips(sender.m_defenseTarget.model.head.position + Vector3.up, CommonFunction.GetConstString("MATCH_TIPS_PERFECT_DEFFENSE"), new Color32(0, 108, 0, 255));
                }
            }

            m_match.m_ruler.SetAssist(ball.m_passer, ball.m_catcher);
        }
    }