Optimized common data
This commit is contained in:
@@ -14,7 +14,7 @@ public partial class CommonData : Node
|
|||||||
// Level information
|
// Level information
|
||||||
public string CurrentLevel;
|
public string CurrentLevel;
|
||||||
|
|
||||||
// Player information
|
// Player stats
|
||||||
public float CurrentHealth;
|
public float CurrentHealth;
|
||||||
public float MaxHealth = 100;
|
public float MaxHealth = 100;
|
||||||
|
|
||||||
@@ -33,13 +33,14 @@ public partial class CommonData : Node
|
|||||||
GetTree().Root.CallDeferred(Node.MethodName.AddChild, inst);
|
GetTree().Root.CallDeferred(Node.MethodName.AddChild, inst);
|
||||||
|
|
||||||
// Start game by loading the main menu
|
// Start game by loading the main menu
|
||||||
scene = GD.Load<PackedScene>("res://Assets/Scenes/MenusAndLevels/MainMenu.tscn");
|
//scene = GD.Load<PackedScene>("res://Assets/Scenes/MenusAndLevels/MainMenu.tscn");
|
||||||
//scene = GD.Load<PackedScene>("res://Assets/Scenes/DEVSCENES/EnemyTest.tscn");
|
scene = GD.Load<PackedScene>("res://Assets/Scenes/DEVSCENES/EnemyTest.tscn");
|
||||||
inst = scene.Instantiate();
|
inst = scene.Instantiate();
|
||||||
GetTree().Root.CallDeferred(Node.MethodName.AddChild, inst);
|
GetTree().Root.CallDeferred(Node.MethodName.AddChild, inst);
|
||||||
PlayMusic("MainMenu");
|
PlayMusic("MainMenu");
|
||||||
|
|
||||||
// Load in saved data
|
// Load in saved data
|
||||||
|
//....?
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
@@ -49,28 +50,18 @@ public partial class CommonData : Node
|
|||||||
GlobalTimer = NumFramesElapsed / FPS;
|
GlobalTimer = NumFramesElapsed / FPS;
|
||||||
GlobalTimer = (float)Convert.ToDouble(GlobalTimer.ToString("0.##")); // Truncates seconds elapsed to hundreds place (0.00)
|
GlobalTimer = (float)Convert.ToDouble(GlobalTimer.ToString("0.##")); // Truncates seconds elapsed to hundreds place (0.00)
|
||||||
//GD.Print(GlobalTimer);
|
//GD.Print(GlobalTimer);
|
||||||
if (Input.IsActionJustPressed("quit_game")){GetTree().Quit();}
|
if (Input.IsActionJustPressed("quit_game")) GetTree().Quit();
|
||||||
|
|
||||||
if (Input.IsActionJustPressed("mute"))
|
if (Input.IsActionJustPressed("mute")){
|
||||||
{
|
Muted = ! Muted;
|
||||||
if (Muted)
|
GetNode<AudioStreamPlayer>("AudioStreamPlayer").VolumeDb = (Muted) ? -80 : 0;
|
||||||
{
|
|
||||||
Muted = false;
|
|
||||||
GetNode<AudioStreamPlayer>("AudioStreamPlayer").VolumeDb = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Muted = true;
|
|
||||||
GetNode<AudioStreamPlayer>("AudioStreamPlayer").VolumeDb = -80;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// BG Audio Management
|
// BG Audio Management
|
||||||
public void StopMusic(){GetNode<AudioStreamPlayer>("AudioStreamPlayer").Stop();}// Stop whatever audio is playing\
|
public void StopMusic(){GetNode<AudioStreamPlayer>("AudioStreamPlayer").Stop();}// Stop whatever audio is playing\
|
||||||
|
|
||||||
public void PlayMusic(string AudioName)
|
public void PlayMusic(string AudioName){
|
||||||
{
|
|
||||||
// Load target audio and play the audio
|
// Load target audio and play the audio
|
||||||
GetNode<AudioStreamPlayer>("AudioStreamPlayer").Stream = (Godot.AudioStream)GD.Load($"res://Assets/Audio/Music/{AudioName}.mp3");
|
GetNode<AudioStreamPlayer>("AudioStreamPlayer").Stream = (Godot.AudioStream)GD.Load($"res://Assets/Audio/Music/{AudioName}.mp3");
|
||||||
GetNode<AudioStreamPlayer>("AudioStreamPlayer").Play();
|
GetNode<AudioStreamPlayer>("AudioStreamPlayer").Play();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Godot.NET.Sdk/4.5.1">
|
<Project Sdk="Godot.NET.Sdk/4.6.0">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net9.0</TargetFramework>
|
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net9.0</TargetFramework>
|
||||||
|
|||||||
7
fracturepoint.csproj.old
Normal file
7
fracturepoint.csproj.old
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<Project Sdk="Godot.NET.Sdk/4.5.1">
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net9.0</TargetFramework>
|
||||||
|
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
@@ -8,11 +8,15 @@
|
|||||||
|
|
||||||
config_version=5
|
config_version=5
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
|
||||||
|
compatibility/default_parent_skeleton_in_mesh_instance_3d=true
|
||||||
|
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="fracturepoint"
|
config/name="fracturepoint"
|
||||||
run/main_scene="uid://bn5opy6atakg"
|
run/main_scene="uid://bn5opy6atakg"
|
||||||
config/features=PackedStringArray("4.5", "C#", "GL Compatibility")
|
config/features=PackedStringArray("4.6", "C#", "GL Compatibility")
|
||||||
run/max_fps=90
|
run/max_fps=90
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user