private void RefreshBalls() { for (uint i = 0; i < refresh_infos[refreshTimeNum].normal; ++i) { UBasketball ball = mCurScene.CreateBall(); IM.Vector3 tempPos = GenerateIn3PTPosition(); tempPos.y = ball.m_ballRadius; ball.SetInitPos(tempPos); ball.m_ballState = BallState.eLoseBall; } for (uint i = 0; i < refresh_infos[refreshTimeNum].special; ++i) { UBasketball ball = mCurScene.CreateBall(); IM.Vector3 tempPos = GenerateIn3PTPosition(); tempPos.y = ball.m_ballRadius; ball.SetInitPos(tempPos); ball.m_special = true; ball.onGrab += OnGrab; ball.m_ballState = BallState.eLoseBall; } ++refreshTimeNum; if (refreshTimeNum < 3) { timer.SetTimer(refresh_infos[refreshTimeNum].interval); timer.stop = false; } else { timer.stop = true; } }
void PositionObjects() { if (curStep.position == null) { return; } foreach (KeyValuePair <int, IM.Vector3> pair in curStep.position) { if (pair.Key == -1) { ball.SetInitPos(pair.Value); } else { Player player = GetPlayer(pair.Key); player.position = pair.Value; if (player.m_bWithBall) { player.m_bMovedWithBall = false; } if (curStep.timeScale == 0) { //player.Update(new IM.Number(Time.deltaTime));//不明白此处的意思,先暂时改为0 player.GameUpdate(IM.Number.zero); } } } }
public override void ResetPlayerPos() { //TODO 针对PVP修改 GrabZonePos grabZonePos = GameSystem.Instance.MatchPointsConfig.GrabZonePos; mainRole.position = grabZonePos.mainRole_transform.position; mainRole.forward = IM.Vector3.forward; npc.position = grabZonePos.npc_transform.position; npc.forward = IM.Vector3.forward; if (mCurScene.balls.Count == 0) { for (int i = 0; i < 5; ++i) { UBasketball ball = mCurScene.CreateBall(); ball.onShoot += OnShoot; ball.onShootGoal += OnGoal; ball.onDunk += OnDunk; } } for (int i = 0; i < 5; ++i) { UBasketball ball = mCurScene.balls[i]; if (ball.m_owner != null) { ball.m_owner.DropBall(ball); } IM.Vector3 tempPos = grabZonePos.balls_transform[i].position; tempPos.y = ball.m_ballRadius; ball.SetInitPos(tempPos); ball.m_ballState = BallState.eLoseBall; } zonePosition = new IM.Vector3[ZONE_COUNT + 1]; for (int i = 0; i < ZONE_COUNT; ++i) { zonePosition[i] = grabZonePos.zones_transform[i].position; } }
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; }