2025-01-04 23:00:19 +08:00

146 lines
5.4 KiB
Lua

---@class BP_BOBORacingCar_C:BP_SciFi_Moto_C
--Edit Below--
local BP_BOBORacingCar = {
OwnerPlayerKey = -1;
bCanStab = true;
StartPos = {X = 0, Y = 0, Z = 0};
StartRot = {Roll = 0, Pitch = 0, Yaw = 0};
BalloonRelativePos = {X = 0, Y = 0, Z = 0};
BalloonRadius = 0;
StabRelativePos = {X = 0, Y = 0, Z = 0};
};
function BP_BOBORacingCar:ReceiveBeginPlay()
self.SuperClass.ReceiveBeginPlay(self);
if UGCGameSystem.IsServer() then
--UGCEventSystem.SetTimer(self, function()
-- self.BoxOverlap.bShouldUpdateOverLaps = true
-- self.BoxOverlap.bGenerateOverlapEvents = true
-- UGCLogSystem.Log("[BP_BOBORacingCar:ReceiveBeginPlay]")
-- UGCLogSystem.Log("[BP_BOBOCar_ReceiveBeginPlay] CollisionEnabled:%s", tostring(self.BoxOverlap:GetCollisionEnabled()))
-- self.BoxOverlap:SetCollisionEnabled(ECollisionEnabled.QueryOnly)
-- UGCSystemLibrary.BindBeginOverlapFunc(self.BoxOverlap, self.OverlapBalloonCallBack, self)
--end, 3)
self.StartPos = self:K2_GetActorLocation()
self.StartRot = self:K2_GetActorRotation()
self.BalloonRelativePos = self.BalloonParent:GetRelativeTransform().Translation
self.StabRelativePos = self.StabPos:GetRelativeTransform().Translation
self.BalloonRadius = self.BalloonMesh:K2_GetComponentScale().X * 50
UGCLogSystem.Log("[BP_BOBOCar_ReceiveBeginPlay] BalloonRelativePos:%s, StabRelativePos:%s", VectorHelper.ToString(self.BalloonRelativePos), VectorHelper.ToString(self.StabRelativePos))
UGCLogSystem.Log("[BP_BOBOCar_ReceiveBeginPlay] Finish")
end
end
--function BP_BOBORacingCar:OverlapBalloonCallBack(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult)
-- UGCLogSystem.Log("[BP_BOBOCar_OverlapBalloonCallBack] OtherActor:%s", tostring(KismetSystemLibrary.GetObjectName(OtherActor)))
-- if not self.bCanStab then return end
-- local Tags = OtherComp.ComponentTags
-- for i, v in pairs(Tags) do
-- if v == "Balloon" then
-- if OtherActor:GetCanStab() then
-- local TargetPlayerKey = OtherActor:GetOwnerPlayerKey()
-- UGCEventSystem.SendEvent(EventEnum.PierceBalloon, self.OwnerPlayerKey, TargetPlayerKey)
-- end
-- break
-- end
-- end
--end
function BP_BOBORacingCar:SetOwnerPlayer(InPlayerKey)
UGCLogSystem.Log("[BP_BOBOCar_SetOwnerPlayer] PlayerKey:%s", tostring(InPlayerKey))
self.OwnerPlayerKey = InPlayerKey
-- self.BP_Balloon.ChildActor:SetOwnerPlayer(InPlayerKey)
end
function BP_BOBORacingCar:GetOwnerPlayerKey()
return self.OwnerPlayerKey
end
function BP_BOBORacingCar:Pierce()
UGCLogSystem.Log("[BP_BOBOCar_Pierce]")
self:SetCanStab(false)
-- self.BP_Balloon.ChildActor:Pierce()
end
function BP_BOBORacingCar:ResetCar()
UGCLogSystem.Log("[BP_BOBOCar_ResetCar]")
UGCVehicleSystem.TeleportVehicleTo(self, self.StartPos, self.StartRot)
self:SetCanStab(true)
-- self.BP_Balloon.ChildActor:ResetBalloon()
end
function BP_BOBORacingCar:SetCanStab(NewCanStab)
if self.bCanStab ~= NewCanStab then
self.bCanStab = NewCanStab
UGCSendRPCSystem.ActorRPCNotify(nil, self, "SetPierceEffect", NewCanStab)
end
end
function BP_BOBORacingCar:GetCanStab()
return self.bCanStab
end
function BP_BOBORacingCar:SetPierceEffect(CanStab)
UGCLogSystem.Log("[BP_BOBOCar_SetPierceEffect]")
self.BalloonMesh:SetHiddenInGame(not CanStab)
self.Cable:SetHiddenInGame(not CanStab)
self.BalloonHandle:SetHiddenInGame(not CanStab)
-- self.Cable:SetHiddenInGame(IsPierce)
if not CanStab then
self.BoomParticle:SetActive(true, true)
SoundSystem.PlaySound(SoundSystem.ESound.Impact)
end
end
function BP_BOBORacingCar:ReceiveTick(DeltaTime)
self.SuperClass.ReceiveTick(self, DeltaTime);
if UGCGameSystem.IsServer() then
-- UGCLogSystem.Log("[BP_BOBOCar_ReceiveTick] bGenerateOverlapEvents:%s", tostring(self.BoxOverlap.bGenerateOverlapEvents))
-- self.BoxOverlap.bShouldUpdateOverLaps = true
-- self.BoxOverlap.bGenerateOverlapEvents = true
end
end
function BP_BOBORacingCar:GetBalloonInfo()
-- UGCLogSystem.Log("[BP_BOBOCar_GetBalloonInfo] BalloonRelativePos:%s", VectorHelper.ToString(self.BalloonParent:GetRelativeTransform().Translation))
-- 这样获得到的位置有问题
-- return self.BalloonParent:K2_GetComponentLocation(), self.BalloonRadius
return VectorHelper.Add(self:GetActorPos(), KismetMathLibrary.GreaterGreater_VectorRotator(self.BalloonParent:GetRelativeTransform().Translation, self:GetActorRot())), self.BalloonRadius
end
function BP_BOBORacingCar:GetStabPos()
-- 这样获得到的位置有问题
-- return self.StabPos:K2_GetComponentLocation()
return VectorHelper.Add(self:GetActorPos(), KismetMathLibrary.GreaterGreater_VectorRotator(self.StabPos:GetRelativeTransform().Translation, self:GetActorRot()))
end
function BP_BOBORacingCar:GetActorPos()
return self.Mesh:K2_GetComponentLocation()
end
function BP_BOBORacingCar:GetActorRot()
return self.Mesh:K2_GetComponentRotation()
end
--[[
function BP_BOBORacingCar:ReceiveEndPlay()
self.SuperClass.ReceiveEndPlay(self);
end
--]]
--[[
function BP_BOBORacingCar:GetReplicatedProperties()
return
end
--]]
--[[
function BP_BOBORacingCar:GetAvailableServerRPCs()
return
end
--]]
return BP_BOBORacingCar;