Files
Nockin_On_Hells_Door/script/Principal.cs
2024-10-28 21:53:03 +01:00

79 lines
1.3 KiB
C#

using Godot;
using System;
public partial class Principal : Control
{
[Export] Panel sub;
[Export] Panel credit;
[Export] AnimationPlayer anim;
bool play_pressed = false;
bool enter = false;
bool touch = false;
Node parent;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
GetTree().Paused = false;
parent = GetParent();
sub.Visible = false;
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
if(play_pressed && Input.IsActionJustPressed("valid") && !enter)
{
enter = true;
anim.Play("play2");
}else if (enter && Input.IsActionJustPressed("valid") && ! touch)
{
touch = true;
anim.Play("play3");
}else if (touch && Input.IsActionJustPressed("valid"))
{
Input.MouseMode = Input.MouseModeEnum.Hidden;
parent.Call("ToCityFunc");
}
}
public void EnterPressed()
{
sub.Visible = true;
}
public void creditEnter()
{
credit.Visible = true;
sub.Visible = false;
}
public void CreditExit()
{
credit.Visible = false;
sub.Visible = true;
}
public void PlayPressed()
{
if (!play_pressed)
{
play_pressed = true;
anim.Play("play");
}
//parent.Call("ToCityFunc");
}
public void ExitGlobPressed()
{
GetTree().Quit();
}
}