22 lines
506 B
C#
22 lines
506 B
C#
using Godot;
|
|
using System;
|
|
|
|
public partial class ResetPlayer : Area2D {
|
|
[Export]
|
|
public Node2D Player { get; set; }
|
|
|
|
[Export]
|
|
public Vector2 ResetPosition { get; set; }
|
|
|
|
public override void _Ready() {
|
|
this.BodyShapeEntered += OnBodyShapeEntered;
|
|
base._Ready();
|
|
}
|
|
|
|
private void OnBodyShapeEntered(Rid bodyRid, Node2D body, long bodyShapeIndex, long localShapeIndex) {
|
|
if (Player == body) {
|
|
Player.Position = ResetPosition;
|
|
}
|
|
}
|
|
}
|