-
Notifications
You must be signed in to change notification settings - Fork 0
/
BackArea.cs
35 lines (30 loc) · 1.02 KB
/
BackArea.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using Godot;
using System;
using System.Linq;
public partial class BackArea : Area2D
{
static StringName BoatFrontArea = "FrontArea";
static StringName RockFrontArea = "RockFrontArea";
static StringName WaveFrontArea = "WaveFrontArea";
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
var overlappingAreas = this.GetOverlappingAreas();
if (overlappingAreas.Any(x => x.Name == BoatFrontArea))
{
GetParent<Polygon2D>().ZIndex = -2;
}
//if (this.Name == "WaveBackArea" && overlappingAreas.Any(x => x.Name == RockFrontArea))
//{
// GetParent<Polygon2D>().ZIndex = -2;
//}
//if (this.Name == "RockBackArea" && overlappingAreas.Any(x => x.Name == WaveFrontArea))
//{
// GetParent<Polygon2D>().ZIndex = -2;
//}
}
}