20 lines
560 B
C#
20 lines
560 B
C#
using Godot;
|
|
using System;
|
|
|
|
public partial class MovingHazard : AnimatableBody3D
|
|
{
|
|
[Export]
|
|
public Vector3 destination;
|
|
[Export(PropertyHint.Range, "0.0, 10.0")]
|
|
public float duration = 1.0f;
|
|
|
|
|
|
public override void _Ready()
|
|
{
|
|
Tween tween = CreateTween();
|
|
tween.SetLoops();
|
|
tween.SetTrans(Tween.TransitionType.Sine);
|
|
tween.TweenProperty(this, "global_position", GlobalPosition + destination, duration);
|
|
tween.TweenProperty(this, "global_position", GlobalPosition - destination, duration);
|
|
}
|
|
}
|