37 lines
740 B
C#
37 lines
740 B
C#
using Godot;
|
|
using System;
|
|
|
|
public partial class revolution : Control
|
|
{
|
|
|
|
[Export]
|
|
private Timer _timer;
|
|
[Export]
|
|
private ColorRect _fade;
|
|
[Export]
|
|
private float fadeRate = 0.1f;
|
|
private float alpha = 1f;
|
|
private bool isReverse = false;
|
|
|
|
|
|
public override void _Ready()
|
|
{
|
|
_timer.Timeout += goToEnd;
|
|
}
|
|
|
|
public override void _Process(double delta)
|
|
{
|
|
alpha -= fadeRate * (float)delta;
|
|
|
|
_fade.Color = new Color(0, 0, 0, alpha);
|
|
}
|
|
|
|
private void goToEnd()
|
|
{
|
|
var scene = GD.Load<PackedScene>("res://endings/the_end.tscn");
|
|
var instance = scene.Instantiate();
|
|
GetNode<Node>("/root/").AddChild(instance);
|
|
this.QueueFree();
|
|
}
|
|
}
|