2025-05-13 19:22:01 +08:00

57 lines
1.1 KiB
C#

using System.Collections.Generic;
using System.ComponentModel;
using Godot;
using Godot.Bridge;
using Godot.NativeInterop;
[ScriptPath("res://Scripts/BridgeSort.cs")]
public partial class BridgeSort : Node2D
{
[Export(PropertyHint.None, "")]
private Area2D triggerDown;
[Export(PropertyHint.None, "")]
private Area2D triggerUp;
[Export(PropertyHint.None, "")]
private int downSort;
[Export(PropertyHint.None, "")]
private int upSort = 50;
[Export(PropertyHint.None, "")]
private Node2D upCol;
[Export(PropertyHint.None, "")]
private Node2D downCol;
public override void _Ready()
{
triggerDown.BodyEntered += Down;
triggerUp.BodyEntered += Up;
base.ZIndex = downSort;
downCol.ProcessMode = ProcessModeEnum.Disabled;
}
public void Up(Node other)
{
if (other is Player)
{
base.ZIndex = upSort;
upCol.ProcessMode = ProcessModeEnum.Disabled;
downCol.ProcessMode = ProcessModeEnum.Inherit;
}
}
public void Down(Node other)
{
if (other is Player)
{
base.ZIndex = downSort;
downCol.ProcessMode = ProcessModeEnum.Disabled;
upCol.ProcessMode = ProcessModeEnum.Inherit;
}
}
}