103 lines
3.0 KiB
Lua
103 lines
3.0 KiB
Lua
|
---@class BP_IceTarget_Move_C:AActor
|
||
|
---@field TargetMesh UStaticMeshComponent
|
||
|
---@field ParticleBoom UParticleSystemComponent
|
||
|
---@field TargetMesh_Old UStaticMeshComponent
|
||
|
---@field DefaultSceneRoot USceneComponent
|
||
|
--Edit Below--
|
||
|
local BP_IceTarget_Move = {
|
||
|
ID = -1;
|
||
|
bShowing = false;
|
||
|
StartPos = {X=0,Y=0,Z=0};
|
||
|
EndPos = {X=0,Y=0,Z=0};
|
||
|
MoveTime = 1;
|
||
|
StartMoveTime = 0;
|
||
|
Score = 3;
|
||
|
};
|
||
|
|
||
|
--[[
|
||
|
function BP_IceTarget_Move:ReceiveBeginPlay()
|
||
|
self.SuperClass.ReceiveBeginPlay(self);
|
||
|
end
|
||
|
--]]
|
||
|
|
||
|
|
||
|
function BP_IceTarget_Move:ReceiveTick(DeltaTime)
|
||
|
self.SuperClass.ReceiveTick(self, DeltaTime);
|
||
|
if self:GetIsShowing() then
|
||
|
local ServerTime = UGCGameSystem.GameState:GetServerGameTime()
|
||
|
local LerpParam = math.clamp((ServerTime - self.StartMoveTime) / self.MoveTime, 0, 1)
|
||
|
local TargetPos = KismetMathLibrary.VLerp(self.StartPos, self.EndPos, LerpParam)
|
||
|
self:K2_SetActorLocation(TargetPos)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
|
||
|
--[[
|
||
|
function BP_IceTarget_Move:ReceiveEndPlay()
|
||
|
self.SuperClass.ReceiveEndPlay(self);
|
||
|
end
|
||
|
--]]
|
||
|
|
||
|
|
||
|
function BP_IceTarget_Move:GetReplicatedProperties()
|
||
|
return
|
||
|
"StartPos",
|
||
|
"EndPos",
|
||
|
"MoveTime"
|
||
|
--"StartMoveTime"
|
||
|
end
|
||
|
|
||
|
|
||
|
--[[
|
||
|
function BP_IceTarget_Move:GetAvailableServerRPCs()
|
||
|
return
|
||
|
end
|
||
|
--]]
|
||
|
|
||
|
function BP_IceTarget_Move:SetID(NewID)
|
||
|
self.ID = NewID
|
||
|
end
|
||
|
|
||
|
function BP_IceTarget_Move:ReceivePointDamage(Damage, DamageType, HitLocation, HitNormal, HitComponent, BoneName, ShotFromDirection, InstigatedBy, DamageCauser, HitInfo)
|
||
|
if UGCGameSystem.IsServer() and self.bShowing then
|
||
|
UGCEventSystem.SendEvent(EventEnum.BreakingIceCubes, InstigatedBy.PlayerKey, self.ID, self.Score)
|
||
|
self:SetShowTarget(false)
|
||
|
UGCSendRPCSystem.ActorRPCNotify(nil, self, "BoomEffect", InstigatedBy.PlayerKey)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function BP_IceTarget_Move:SetShowTarget(IsShow)
|
||
|
self.bShowing = IsShow
|
||
|
if UGCGameSystem.IsServer() then
|
||
|
self.StartMoveTime = UGCGameSystem.GameState:GetServerGameTime()
|
||
|
UGCSendRPCSystem.ActorRPCNotify(nil, self, "ClientSetStartMoveTime", self.StartMoveTime)
|
||
|
UGCLogSystem.Log("[BP_IceTarget_Move_SetShowTarget] Finish")
|
||
|
else
|
||
|
self.TargetMesh:SetHiddenInGame(not IsShow)
|
||
|
end
|
||
|
local BlockType = (IsShow and ECollisionEnabled.QueryAndPhysics or ECollisionEnabled.NoCollision)
|
||
|
self.TargetMesh:SetCollisionEnabled(BlockType)
|
||
|
end
|
||
|
|
||
|
function BP_IceTarget_Move:ClientSetStartMoveTime(InStartMoveTime)
|
||
|
self.StartMoveTime = InStartMoveTime
|
||
|
end
|
||
|
|
||
|
function BP_IceTarget_Move:SetMoveParam(InStartPos, InEndPos, InMoveTime, InScore)
|
||
|
self.StartPos, self.EndPos, self.MoveTime, self.Score = InStartPos, InEndPos, InMoveTime, InScore
|
||
|
end
|
||
|
|
||
|
function BP_IceTarget_Move:GetIsShowing()
|
||
|
return self.bShowing
|
||
|
end
|
||
|
|
||
|
function BP_IceTarget_Move:BoomEffect(PlayerKey)
|
||
|
if PlayerKey == UGCSystemLibrary.GetLocalPlayerKey() then
|
||
|
SoundSystem.PlaySound(SoundSystem.ESound.AddScore)
|
||
|
else
|
||
|
SoundSystem.PlaySound(SoundSystem.ESound.Impact)
|
||
|
end
|
||
|
self.ParticleBoom:SetActive(true, true);
|
||
|
end
|
||
|
|
||
|
return BP_IceTarget_Move;
|