init commit
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class PreGame : Control {
|
||||
|
||||
Options _Options;
|
||||
Reference _Reference;
|
||||
Label _AbilityLabel;
|
||||
public Ability _Ability = Ability.None;
|
||||
|
||||
[Export]
|
||||
public PackedScene Backpack;
|
||||
|
||||
public override void _Ready() {
|
||||
_Reference = GetNode<Reference>("/root/Reference");
|
||||
_Options = GetNode<Options>( "/root/Options" );
|
||||
_Reference.PreGame = this;
|
||||
_AbilityLabel = this.GetChild<Label>(0);
|
||||
_AbilityLabel.Text = "Current Ability : " + _Ability.ToString();
|
||||
}
|
||||
|
||||
public void _on_ability_pressed() {
|
||||
int AbilityIndex = (int)_Ability;
|
||||
_Ability = ( Ability )(AbilityIndex + 1);
|
||||
if( AbilityIndex >= Enum.GetValues( typeof( Ability ) ).Length - 1 ) {
|
||||
_Ability = 0;
|
||||
}
|
||||
_AbilityLabel.Text = "Current Ability : " + _Ability.ToString();
|
||||
}
|
||||
|
||||
public void _on_player_spawn_pressed(){
|
||||
Inventory inv = Backpack.Instantiate<Inventory>();
|
||||
GetNode<Control>("/root/GameRoot/UI/GameUI").AddChild(inv);
|
||||
inv.Name = "Inventory";
|
||||
|
||||
_Reference.GameHandler.SpawnPlayer( Multiplayer.GetUniqueId(), _Options._SettingsFile.Game.UserName, _Ability );
|
||||
_Reference.PreGame.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public enum Ability {
|
||||
None, // No boost perk
|
||||
Vitality, // Gain slightly more health
|
||||
Strength, // Gain extra weight carrying | moves faster with more stuff
|
||||
Stamina, // Run Faster
|
||||
}
|
||||
Reference in New Issue
Block a user