【FORTNITE】verse講座#5

エイムを極めろ!練習マップつくろうぜ

Verseコード

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Verse.org/Random }

Aim := class(creative_device):
    @editable
    RootProp : creative_prop = creative_prop{}

    @editable
    TargetMoveOffset : float = 100.0

    @editable
    TargetMoveTime : float = 0.5

    @editable
    TargetTrigger : trigger_device = trigger_device{}


    
    OnBegin<override>()<suspends>:void=
        TargetTrigger.TriggeredEvent.Subscribe(OnTriggeredEvent)
    
    OnTriggeredEvent(Player:?agent):void=
        
        CurrentLocation := RootProp.GetTransform().Translation
        
        
        MinV := TargetMoveOffset
        MaxV := -TargetMoveOffset 
        localX := GetRandomFloat(MinV, MaxV)
        localY := GetRandomFloat(MinV, MaxV)
        localZ := GetRandomFloat(MinV, MaxV)
        var Position : vector3 = CurrentLocation + vector3{X:=localX, Y:=localY, Z:= localZ}
        
        
        if(Position.Z < 0.0 or Position.Z > 200.0):
            set Position = vector3{X:=Position.X, Y:=Position.Y, Z:=100.0}
        
        
        Rotation : rotation = MakeRotationFromYawPitchRollDegrees(0.0, 0.0, 0.0)
        
        
        spawn{RootProp.MoveTo(Position, Rotation, TargetMoveTime)}

ご質問やご感想はお気軽にコメント欄まで!

コメントする