public void LaunchLaser(byte clientSeat, short degree) { if (m_bMyself) { m_bLauncherXPSkill = false; ClearXPSkillEft(); m_EnergyPoolLogic[LauncherType].LaserCDState = true; m_EnergyPoolLogic[LauncherType].Rollback = true; m_EnergyPoolLogic[LauncherType].PlayRollbackPoolUI(1000); m_EnergyPoolUI.fillAmount = m_EnergyPoolLogic[LauncherType].FillAmount; } Vector3 startPos; Vector3 dir; degree = SceneRuntime.AngleInversion(degree); SceneRuntime.GetBulletPosAndDir(clientSeat, degree, out dir, out startPos); if (!m_bMyself) { Vector2 direction = new Vector2(dir.x, dir.y); Direction = direction; UpdatOtherAngle(); } SceneRuntime.LauncherEftMgr.PlayXPSkillMuzzleEft(m_GunBarrel.BaseTransform, LauncherType, startPos, m_LauncherSetting.LaserCDTime); SceneRuntime.LauncherEftMgr.PlayLaserEft(m_GunBarrel.BaseTransform, LauncherType, clientSeat, Direction, startPos, m_Angle); // SceneRuntime.LauncherEftMgr.RemoveAtEffect(); }
public void LaunchBullet(NetCmdPack pack) { NetCmdBullet cmd = (NetCmdBullet)pack.cmd; byte clientSeat, id; SceneRuntime.BuuletIDToSeat(cmd.BulletID, out clientSeat, out id); if (GetPlayer(clientSeat) == null) { return; } ScenePlayer sp = GetPlayer(clientSeat); if (sp.Launcher.LauncherType != cmd.LauncherType) { sp.Launcher.ChangeLauncher(cmd.LauncherType, true); } if (sp == null) { LogMgr.Log("不存在的玩家座位:" + clientSeat); return; } float elapsedTime = (Utility.GetTickCount() - pack.tick) * 0.001f + SceneRuntime.NetDelayTime; short degree = SceneRuntime.AngleInversion(cmd.Degree); SceneRuntime.BulletMgr.LaunchBullet(cmd.BulletID, sp.Launcher.LauncherType, sp.RateIndex, degree, elapsedTime, cmd.ReboundCount, cmd.LockFishID); sp.Launcher.LauncherBullet(cmd.Energy); // SceneRuntime.SceneLogic.LaunchBullet(clientSeat, sp.Launcher.LauncherType, sp.RateIndex); int gold = LauncherSetting.LauncherDataList[sp.Launcher.LauncherType].Consume * BulletSetting.BulletRate[sp.RateIndex]; ConsumeGold(clientSeat, gold, sp); }
public void LaunchSyncBullet(NetCmdPack pack) { NetCmdSyncBullet cmd = (NetCmdSyncBullet)pack.cmd; float elapsedTime = (Utility.GetTickCount() - pack.tick) * 0.001f + SceneRuntime.NetDelayTime; for (int i = 0; i < cmd.Bullets.Length; ++i) { SyncBulletData data = cmd.Bullets[i]; byte clientSeat, id; SceneRuntime.BuuletIDToSeat(data.BulletID, out clientSeat, out id); ScenePlayer sp = GetPlayer(clientSeat); if (sp == null) { //LogMgr.Log("不存在的玩家座位:" + clientSeat); return; } short degree = SceneRuntime.AngleInversion(data.Degree); SceneRuntime.BulletMgr.LaunchBullet(data.BulletID, data.BulletType, data.RateIdx, degree, data.Time * 0.001f + elapsedTime, data.ReboundCount, data.LockFishID /*, data.CollideCount, data.PauseTime * 0.001f, data.SpeedScaling * 0.001f*/); //int gold = LauncherSetting.LauncherDataList[data.BulletType].Consume * BulletSetting.BulletRate[data.RateIdx]; //ConsumeGold(clientSeat, gold, sp); } }
public void Update(float delta) { m_GunBarrel.Update(delta); if (m_LockedFishEft.m_LifeTime > 0) { m_LockedFishEft.m_LifeTime -= delta; if (m_LockedFishEft.m_LifeTime <= 0) { m_LockedFishEft.m_Obj.SetActive(false); } } //处理能量槽回滚 if (m_EnergyPoolLogic[LauncherType].Rollback) { m_EnergyPoolLogic[LauncherType].PlayRollbackPoolUI(delta); m_EnergyPoolUI.fillAmount = m_EnergyPoolLogic[LauncherType].FillAmount; } //处于大招CD状态 if (m_EnergyPoolLogic[LauncherType].LaserCDState) { m_EnergyPoolLogic[LauncherType].PlayCD(delta); return; } //大招的硬直状态 if (m_EnergyPoolLogic[LauncherType].HitRecoverState) { m_EnergyPoolLogic[LauncherType].Update(delta); return; } #if UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX UpdateRootPos(); //更新炮台最新位置 #else if (m_bFirstUpdatePos) { UpdateRootPos(); //更新炮台最新位置 m_bFirstUpdatePos = false; } #endif ushort lockfishID = SceneRuntime.PlayerMgr.LockedFishID; if (lockfishID != 0) { Fish fish = SceneRuntime.FishMgr.FindFishByID(lockfishID); if (fish != null) { UpdateLaunchByLockFish(fish.ScreenPos); } } else { UpdateLaunchAngle(); //更新炮台角度 } //m_GunBarrel.Update(delta); CheckIsBankruptcy(); m_LauncherTime += delta; if (CheckXPSkill()) { //向服务器发送大招请求 short angle = Utility.FloatToShort(m_Angle); angle = SceneRuntime.AngleInversion(angle); if (SceneRuntime.SceneLogic.UseLaser(angle)) { m_bLauncherXPSkill = true; m_EnergyPoolLogic[LauncherType].bSendXPSkill = false; } } if (CheckLaunch()) { if (m_LauncherTime >= m_LauncherInterval) { m_LauncherTime = 0; //检测是否钱够 if (PlayerRole.Instance.GetPlayerGlobelBySeat(m_Seat) < (BulletSetting.BulletRate[m_RateIndx] * m_LauncherSetting.Consume)) { if (GetMaxRate()) { return; } SceneRuntime.PlayerMgr.StopAutoShotAndLocked(); if (m_AutoShotCancel.activeSelf) { m_AutoShotCancel.SetActive(false); } // GlobalHallUIMgr.Instance.ShowSystemTipsUI(StringTable.GetString("GoldNotEnough"), 1, false); if (PlayerRole.Instance.RoleInfo.RoleMe.GetMonthID() == 0) { GlobalEffectMgr.Instance.ShutDownMsgBox(); GlobalHallUIMgr.Instance.ShowPayWnd(PayType.Gold); } else { GlobalHallUIMgr.Instance.ShowMatchMsgBox("", PlayerRole.Instance.RoleInfo.RoleMe.GetMonthID(), MatchMsgBoxType.Match_BuyGold); } return; } short angle = Utility.FloatToShort(m_Angle); angle = SceneRuntime.AngleInversion(angle); SceneRuntime.SceneLogic.LaunchBullet(angle); } } }