---@class UGCGameState_C:BP_UGCGameState_C --Edit Below-- UGCGameSystem.UGCRequire('Script.Common.ue_enum_custom') UGCGameSystem.UGCRequire('Script.Global.Global') local UGCGameState = {}; function UGCGameState:ReceiveBeginPlay() self.IsShowDeadBox = false; UGCEventSystem.AddListener(EventEnum.PlayerDeathInfo, self.RespawnPlayer, self) if UGCGameSystem.IsServer() then else self:InitBulletFXPool(30) end end function UGCGameState:RespawnPlayer(DeadPlayerKey) UGCEventSystem.SetTimer(self, function() UGCGameSystem.RespawnPlayer(DeadPlayerKey) end, 4) end function UGCGameState:GetPreViewFXActor() if not UE.IsValid(self.PreViewActor) then self.PreViewActor = UGCSystemLibrary.GetUniqueInstanceFromPath(UGCGameSystem.GetUGCResourcesFullPath('Asset/Blueprint/SceneActor/BP_PreViewFXActor.BP_PreViewFXActor_C')) end return self.PreViewActor end function UGCGameState:SpawnParticleAtPos(Pos) local TempPreViewActor = self:GetPreViewFXActor() if UE.IsValid(TempPreViewActor) then local KillParticle = TempPreViewActor:GetNowFXFromFXType(EFXType.Kill) if UE.IsValid(KillParticle) then Pos = { X = Pos.X + TempPreViewActor.KillParticleOffsetTF.Translation.X, Y = Pos.Y + TempPreViewActor.KillParticleOffsetTF.Translation.Y, Z = Pos.Z + TempPreViewActor.KillParticleOffsetTF.Translation.Z, } local FXScale = {X = TempPreViewActor.KillParticleOffsetTF.Scale3D.X, Y = TempPreViewActor.KillParticleOffsetTF.Scale3D.Y, Z = TempPreViewActor.KillParticleOffsetTF.Scale3D.Z} local KillParticleComp = GameplayStatics.SpawnEmitterAtLocation(self, KillParticle, Pos, {Roll = 0, Pitch = 0, Yaw = 0}, FXScale, true) -- 设置颜色 TempPreViewActor:SetParticleCompColor(KillParticleComp, EFXType.Kill) end end end function UGCGameState:InitBulletFXPool(Count) self.BulletFXPool = {} self.BulletFXPoolIndex = 1; local BulletTailFXClass = UE.LoadClass(UGCGameSystem.GetUGCResourcesFullPath('Asset/FX/BulletFX/BP_BulletTailFX.BP_BulletTailFX_C')) for i = 1, Count do local BulletTailFXActor = UGCGameSystem.SpawnActor(self, BulletTailFXClass, VectorHelper.VectorZero(), VectorHelper.RotZero(), VectorHelper.ScaleOne()) self.BulletFXPool[#self.BulletFXPool + 1] = BulletTailFXActor BulletTailFXActor:StopFly() end end function UGCGameState:GetBulletFXActor() local Res = self.BulletFXPool[self.BulletFXPoolIndex] self.BulletFXPoolIndex = (self.BulletFXPoolIndex % #self.BulletFXPool) + 1 return Res end -- function UGCGameState:ReceiveTick(DeltaTime) -- end -- function UGCGameState:ReceiveEndPlay() -- end return UGCGameState;