162 lines
5.9 KiB
Lua
162 lines
5.9 KiB
Lua
---@class BP_BOBOCar_C:BP_SciFi_Moto_C
|
|
---@field StabPos USphereComponent
|
|
---@field Thrusting_FloorTiles_02 UStaticMeshComponent
|
|
---@field Thrusting_FloorTiles_01 UStaticMeshComponent
|
|
---@field BalloonMesh UStaticMeshComponent
|
|
---@field BalloonMesh_New UStaticMeshComponent
|
|
---@field StaticMesh UStaticMeshComponent
|
|
---@field CG011_4Elements_Pickup01 UStaticMeshComponent
|
|
---@field Cable UCableComponent
|
|
---@field BalloonHandle UStaticMeshComponent
|
|
---@field BoomParticle UParticleSystemComponent
|
|
---@field BalloonMesh_Old UStaticMeshComponent
|
|
---@field BalloonParent USceneComponent
|
|
--Edit Below--
|
|
local BP_BOBOCar = {
|
|
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_BOBOCar:ReceiveBeginPlay()
|
|
self.SuperClass.ReceiveBeginPlay(self);
|
|
if UGCGameSystem.IsServer() then
|
|
--UGCEventSystem.SetTimer(self, function()
|
|
-- self.BoxOverlap.bShouldUpdateOverLaps = true
|
|
-- self.BoxOverlap.bGenerateOverlapEvents = true
|
|
-- UGCLogSystem.Log("[BP_BOBOCar: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_BOBOCar: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_BOBOCar:SetOwnerPlayer(InPlayerKey)
|
|
UGCLogSystem.Log("[BP_BOBOCar_SetOwnerPlayer] PlayerKey:%s", tostring(InPlayerKey))
|
|
self.OwnerPlayerKey = InPlayerKey
|
|
-- self.BP_Balloon.ChildActor:SetOwnerPlayer(InPlayerKey)
|
|
end
|
|
function BP_BOBOCar:GetOwnerPlayerKey()
|
|
return self.OwnerPlayerKey
|
|
end
|
|
|
|
function BP_BOBOCar:Pierce()
|
|
UGCLogSystem.Log("[BP_BOBOCar_Pierce]")
|
|
self:SetCanStab(false)
|
|
-- self.BP_Balloon.ChildActor:Pierce()
|
|
end
|
|
|
|
function BP_BOBOCar:ResetCar()
|
|
UGCLogSystem.Log("[BP_BOBOCar_ResetCar]")
|
|
UGCVehicleSystem.TeleportVehicleTo(self, self.StartPos, self.StartRot)
|
|
self:SetCanStab(true)
|
|
-- self.BP_Balloon.ChildActor:ResetBalloon()
|
|
end
|
|
|
|
function BP_BOBOCar:SetCanStab(NewCanStab)
|
|
if self.bCanStab ~= NewCanStab then
|
|
self.bCanStab = NewCanStab
|
|
UGCSendRPCSystem.ActorRPCNotify(nil, self, "SetPierceEffect", NewCanStab)
|
|
end
|
|
end
|
|
|
|
function BP_BOBOCar:GetCanStab()
|
|
return self.bCanStab
|
|
end
|
|
|
|
function BP_BOBOCar:SetPierceEffect(CanStab)
|
|
UGCLogSystem.Log("[BP_BOBOCar_SetPierceEffect]")
|
|
self.BalloonMesh_New: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_BOBOCar: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_BOBOCar: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_BOBOCar:GetStabPos()
|
|
-- 这样获得到的位置有问题
|
|
-- return self.StabPos:K2_GetComponentLocation()
|
|
return VectorHelper.Add(self:GetActorPos(), KismetMathLibrary.GreaterGreater_VectorRotator(self.StabPos:GetRelativeTransform().Translation, self:GetActorRot()))
|
|
end
|
|
|
|
function BP_BOBOCar:GetRadius()
|
|
return self.StabPos.GetScaledSphereRadius()
|
|
end
|
|
|
|
function BP_BOBOCar:GetActorPos()
|
|
return self.Mesh:K2_GetComponentLocation()
|
|
end
|
|
|
|
function BP_BOBOCar:GetActorRot()
|
|
return self.Mesh:K2_GetComponentRotation()
|
|
end
|
|
|
|
--[[
|
|
function BP_BOBOCar:ReceiveEndPlay()
|
|
self.SuperClass.ReceiveEndPlay(self);
|
|
end
|
|
--]]
|
|
|
|
--[[
|
|
function BP_BOBOCar:GetReplicatedProperties()
|
|
return
|
|
end
|
|
--]]
|
|
|
|
--[[
|
|
function BP_BOBOCar:GetAvailableServerRPCs()
|
|
return
|
|
end
|
|
--]]
|
|
|
|
return BP_BOBOCar; |