Mutually_Assured_Destruction/endings/revolution.cs

37 lines
740 B
C#
Raw Normal View History

2023-06-11 17:08:30 -04:00
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();
}
}