-
Notifications
You must be signed in to change notification settings - Fork 0
/
FrontArea.cs
35 lines (30 loc) · 998 Bytes
/
FrontArea.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 FrontArea : Area2D
{
static StringName BoatBackArea = "BackArea";
static StringName RockBackArea = "RockBackArea";
static StringName WaveBackArea = "WaveBackArea";
// 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 == BoatBackArea))
{
GetParent<Polygon2D>().ZIndex = 0;
}
//if (this.Name == "WaveFrontArea" && overlappingAreas.Any(x => x.Name == RockBackArea))
//{
// GetParent<Polygon2D>().ZIndex = 0;
//}
//if (this.Name == "RockFrontArea" && overlappingAreas.Any(x => x.Name == WaveBackArea))
//{
// GetParent<Polygon2D>().ZIndex = 0;
//}
}
}