-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArrow.cs
43 lines (37 loc) · 878 Bytes
/
Arrow.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
36
37
38
39
40
41
using Godot;
using System;
public partial class Arrow : Area2D
{
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
this.Modulate = new Color(255, 255, 255);
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
private void _on_area_entered(Area2D area)
{
if (area is Plane) {
this.Modulate = new Color(255, 0, 0);
GetNode<Game>("/root/Game").Score += 10;
}
}
private void _on_area_exited(Area2D area)
{
if (area is Plane) {
var timer = new Timer
{
Autostart = true,
WaitTime = 3,
ProcessMode = ProcessModeEnum.Pausable,
OneShot = true
};
AddChild(timer);
timer.Timeout += () => {
this.Modulate = new Color(255, 255, 255);
};
}
}
}