reworking effects, turning them into their own scene for replicability
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class Action : Node
|
||||
{
|
||||
public float _timerSeconds, _cooldownSeconds;
|
||||
public Contact _contact;
|
||||
public virtual void Fire()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
public partial class Example1 : Action
|
||||
{
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
}
|
||||
|
||||
public override void Fire()
|
||||
{
|
||||
base.Fire();
|
||||
// GD.Print(_owner);
|
||||
List<Shield> unbrokenShields = [.. _contact._owner._board._shields.Where(s=>!s._broken)];
|
||||
int shieldNumber = Globals._rng.Next(0, unbrokenShields.Count);
|
||||
int damageAmount = Globals._rng.Next(-12,-8);
|
||||
_contact._owner._board._shields[shieldNumber].ChangeHealth(damageAmount);
|
||||
((Player)_contact._owner)._phone._debug.Text = "Shield " + shieldNumber + " damaged " + damageAmount + "hp";
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://bgl77ljlxm6xf
|
||||
@@ -1,22 +0,0 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
public partial class Example2 : Action
|
||||
{
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
}
|
||||
|
||||
public override void Fire()
|
||||
{
|
||||
base.Fire();
|
||||
int shieldNumber = 2;
|
||||
int damageAmount = Globals._rng.Next(-50,-30);
|
||||
_contact._owner._board._shields[shieldNumber].ChangeHealth(damageAmount);
|
||||
((Player)_contact._owner)._phone._debug.Text = "Shield " + shieldNumber + " damaged " + damageAmount + "hp";
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://bsmvcs8l2p211
|
||||
@@ -1,77 +1,54 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
public partial class Contact : Sprite2D
|
||||
{
|
||||
public bool _clickable = false, _interval = false;
|
||||
public int _number, _calls = 0, _maxCalls = 0;
|
||||
public Timer _timer, _cooldown;
|
||||
public Action _action;
|
||||
public Actor _owner;
|
||||
public int _number;
|
||||
public List<Effect> _effects;
|
||||
public PhoneButton _button;
|
||||
// public
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_timer = GetNode<Timer>("Timer");
|
||||
_cooldown = GetNode<Timer>("Cooldown");
|
||||
_action = GetNode<Action>("Action");
|
||||
_action._contact = this;
|
||||
|
||||
}
|
||||
|
||||
public virtual void CallAction()
|
||||
public virtual void FireEffect()
|
||||
{
|
||||
if (_cooldown.TimeLeft == 0 || _action._cooldownSeconds == 0)
|
||||
{
|
||||
GD.Print("Action fired!!");
|
||||
_action.Fire();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public virtual void End()
|
||||
{
|
||||
_effects.ForEach(e=>e.End());
|
||||
}
|
||||
|
||||
public void LoadEffect(string EFFECT_NAME, string EFFECT_TYPE)
|
||||
{
|
||||
PackedScene scene = ResourceLoader.Load<PackedScene>("res://Gameplay/Effects/"+EFFECT_TYPE+"/"+EFFECT_NAME+".tscn");
|
||||
Effect instance = scene.Instantiate<Effect>();
|
||||
|
||||
AddChild(instance);
|
||||
Effect newEffect = (Effect)GetChildren().Single(c=>c==instance);
|
||||
|
||||
newEffect.SetContact(this);
|
||||
// TimeEffect1 newEffect = scene.Instantiate();
|
||||
// AddChild(newEffect);
|
||||
// GD.Print(newEffect);
|
||||
// newEffect._contact = this;
|
||||
// _effects.Add(newEffect);
|
||||
}
|
||||
|
||||
public void PassNumber(int NUMBER)
|
||||
{
|
||||
_number = NUMBER;
|
||||
}
|
||||
public void PassOwner(Actor OWNER)
|
||||
{
|
||||
_owner = OWNER;
|
||||
}
|
||||
|
||||
public void SetTimer(float SECONDS)
|
||||
public virtual void Start()
|
||||
{
|
||||
_action._timerSeconds = SECONDS;
|
||||
_interval = true;
|
||||
_clickable = false;
|
||||
}
|
||||
|
||||
public void SetCooldown(float SECONDS)
|
||||
{
|
||||
_action._cooldownSeconds = SECONDS;
|
||||
_interval = false;
|
||||
_clickable = true;
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
// GD.Print(_action._timerSeconds);
|
||||
if (_action._timerSeconds > 0)
|
||||
{
|
||||
_timer.Start(_action._timerSeconds);
|
||||
_calls = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTimerTimeout()
|
||||
{
|
||||
if (_calls <= _maxCalls || _maxCalls == 0)
|
||||
{
|
||||
CallAction();
|
||||
_timer.Start(_action._timerSeconds);
|
||||
_calls++;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCooldownTimeout()
|
||||
{
|
||||
|
||||
_effects.ForEach(e=>e.Start());
|
||||
}
|
||||
}
|
||||
|
||||
27
Gameplay/Effect.cs
Normal file
27
Gameplay/Effect.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class Effect : Node
|
||||
{
|
||||
public Contact _contact;
|
||||
public virtual void Fire()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void End()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void SetContact(Contact CONTACT)
|
||||
{
|
||||
_contact = CONTACT;
|
||||
GD.Print(_contact);
|
||||
}
|
||||
|
||||
public virtual void Start()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
61
Gameplay/Effects/ClickEffect.cs
Normal file
61
Gameplay/Effects/ClickEffect.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class ClickEffect : Effect
|
||||
{
|
||||
public bool _available;
|
||||
public int _calls = 0, _maxCalls = 0;
|
||||
public float _timerSeconds;
|
||||
public Timer _timer;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
_timer = GetNode<Timer>("Timer");
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
base._Process(delta);
|
||||
if (_contact._button._phone._running)
|
||||
{
|
||||
_contact._button._progressBar.Value = Math.Round(_timer.TimeLeft / _timerSeconds * 100, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Fire()
|
||||
{
|
||||
base.Fire();
|
||||
if (_available && (_calls <= _maxCalls || _maxCalls == 0))
|
||||
{
|
||||
_calls++;
|
||||
_timer.Start(_timerSeconds);
|
||||
}
|
||||
}
|
||||
|
||||
public override void End()
|
||||
{
|
||||
_contact._button._progressBar.Value = 0;
|
||||
}
|
||||
|
||||
public virtual void SetTimer(int SECONDS)
|
||||
{
|
||||
_timerSeconds = SECONDS;
|
||||
}
|
||||
|
||||
public override void Start()
|
||||
{
|
||||
base.Start();
|
||||
_available = false;
|
||||
_calls = 0;
|
||||
_timer.Start(_timerSeconds);
|
||||
}
|
||||
|
||||
private void OnTimerTimeout()
|
||||
{
|
||||
if (_calls <= _maxCalls || _maxCalls == 0)
|
||||
{
|
||||
_available = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
1
Gameplay/Effects/ClickEffect.cs.uid
Normal file
1
Gameplay/Effects/ClickEffect.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b2h6prsg8m1y7
|
||||
20
Gameplay/Effects/ClickEffects/ClickEffect1.cs
Normal file
20
Gameplay/Effects/ClickEffects/ClickEffect1.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public partial class ClickEffect1 : ClickEffect
|
||||
{
|
||||
public override void Fire()
|
||||
{
|
||||
base.Fire();
|
||||
if (_available && (_calls <= _maxCalls || _maxCalls == 0))
|
||||
{
|
||||
List<Shield> shields = _contact._button._phone._player._board._shields.Where(s=>!s._broken).ToList();
|
||||
int shieldNumber = Globals._rng.Next(0, shields.Count);
|
||||
int damage = Globals._rng.Next(-50,-30);
|
||||
shields[shieldNumber].ChangeHealth(damage);
|
||||
_contact._button._phone._player._debug.Text = "Shield "+shieldNumber+" damaged for "+damage+" Damage!";
|
||||
}
|
||||
}
|
||||
}
|
||||
1
Gameplay/Effects/ClickEffects/ClickEffect1.cs.uid
Normal file
1
Gameplay/Effects/ClickEffects/ClickEffect1.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://qmmft72g5uj6
|
||||
9
Gameplay/Effects/ClickEffects/click_effect1.tscn
Normal file
9
Gameplay/Effects/ClickEffects/click_effect1.tscn
Normal file
@@ -0,0 +1,9 @@
|
||||
[gd_scene format=3 uid="uid://dkio7bpdjyh6q"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://fygidhjkgabe" path="res://Gameplay/effect.tscn" id="1_dgxlt"]
|
||||
[ext_resource type="Script" uid="uid://qmmft72g5uj6" path="res://Gameplay/Effects/ClickEffects/ClickEffect1.cs" id="2_wfqii"]
|
||||
|
||||
[node name="ClickEffect1" unique_id=110922950 instance=ExtResource("1_dgxlt")]
|
||||
script = ExtResource("2_wfqii")
|
||||
|
||||
[node name="Timer" type="Timer" parent="." index="0" unique_id=801745901]
|
||||
7
Gameplay/Effects/PassiveEffect.cs
Normal file
7
Gameplay/Effects/PassiveEffect.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class PassiveEffect : Effect
|
||||
{
|
||||
|
||||
}
|
||||
1
Gameplay/Effects/PassiveEffect.cs.uid
Normal file
1
Gameplay/Effects/PassiveEffect.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://by1gyhcy001o0
|
||||
7
Gameplay/Effects/PassiveEffects/PassiveEffect1.cs
Normal file
7
Gameplay/Effects/PassiveEffects/PassiveEffect1.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class PassiveEffect1 : PassiveEffect
|
||||
{
|
||||
|
||||
}
|
||||
1
Gameplay/Effects/PassiveEffects/PassiveEffect1.cs.uid
Normal file
1
Gameplay/Effects/PassiveEffects/PassiveEffect1.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ctrfj2ixcrwa1
|
||||
58
Gameplay/Effects/TimeEffect.cs
Normal file
58
Gameplay/Effects/TimeEffect.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Runtime.InteropServices.Marshalling;
|
||||
|
||||
public partial class TimeEffect : Effect
|
||||
{
|
||||
public int _calls = 0, _maxCalls = 0;
|
||||
public float _timerSeconds;
|
||||
public Timer _timer;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
_timer = GetNode<Timer>("Timer");
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
base._Process(delta);
|
||||
if (_contact._button._phone._running)
|
||||
{
|
||||
_contact._button._progressBar.Value = Math.Round(_timer.TimeLeft / _timerSeconds * 100, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Fire()
|
||||
{
|
||||
base.Fire();
|
||||
if (_calls <= _maxCalls || _maxCalls == 0)
|
||||
{
|
||||
_calls++;
|
||||
_timer.Start(_timerSeconds);
|
||||
}
|
||||
}
|
||||
|
||||
public override void End()
|
||||
{
|
||||
_contact._button._progressBar.Value = 0;
|
||||
}
|
||||
|
||||
public virtual void SetTimer(float SECONDS)
|
||||
{
|
||||
_timerSeconds = SECONDS;
|
||||
}
|
||||
|
||||
public override void Start()
|
||||
{
|
||||
base.Start();
|
||||
_calls = 0;
|
||||
_timer.Start(_timerSeconds);
|
||||
}
|
||||
|
||||
private void OnTimerTimeout()
|
||||
{
|
||||
Fire();
|
||||
}
|
||||
|
||||
}
|
||||
1
Gameplay/Effects/TimeEffect.cs.uid
Normal file
1
Gameplay/Effects/TimeEffect.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://jvk7ejpb7xnc
|
||||
21
Gameplay/Effects/TimeEffects/TimeEffect1.cs
Normal file
21
Gameplay/Effects/TimeEffects/TimeEffect1.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public partial class TimeEffect1 : TimeEffect
|
||||
{
|
||||
public override void Fire()
|
||||
{
|
||||
base.Fire();
|
||||
if (_calls <= _maxCalls || _maxCalls == 0)
|
||||
{
|
||||
List<Shield> shields = _contact._button._phone._player._board._shields.Where(s=>!s._broken).ToList();
|
||||
int shieldNumber = Globals._rng.Next(0, shields.Count);
|
||||
int damage = Globals._rng.Next(-12,-8);
|
||||
shields[shieldNumber].ChangeHealth(damage);
|
||||
_contact._button._phone._player._debug.Text = "Shield "+shieldNumber+" damaged for "+damage+" Damage!";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
1
Gameplay/Effects/TimeEffects/TimeEffect1.cs.uid
Normal file
1
Gameplay/Effects/TimeEffects/TimeEffect1.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b3ql333letuv
|
||||
10
Gameplay/Effects/TimeEffects/time_effect_1.tscn
Normal file
10
Gameplay/Effects/TimeEffects/time_effect_1.tscn
Normal file
@@ -0,0 +1,10 @@
|
||||
[gd_scene format=3 uid="uid://dxr716rnqu2e"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b3ql333letuv" path="res://Gameplay/Effects/TimeEffects/TimeEffect1.cs" id="1_l6ud1"]
|
||||
|
||||
[node name="TimeEffect1" type="Node" unique_id=980963154]
|
||||
script = ExtResource("1_l6ud1")
|
||||
|
||||
[node name="Timer" type="Timer" parent="." unique_id=1364707554]
|
||||
|
||||
[connection signal="timeout" from="Timer" to="." method="OnTimerTimeout"]
|
||||
9
Gameplay/Effects/click_effect.tscn
Normal file
9
Gameplay/Effects/click_effect.tscn
Normal file
@@ -0,0 +1,9 @@
|
||||
[gd_scene format=3 uid="uid://dg1haube60fgt"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://fygidhjkgabe" path="res://Gameplay/effect.tscn" id="1_udl8u"]
|
||||
[ext_resource type="Script" uid="uid://jvk7ejpb7xnc" path="res://Gameplay/Effects/TimeEffect.cs" id="2_uob21"]
|
||||
|
||||
[node name="ClickEffect" unique_id=110922950 instance=ExtResource("1_udl8u")]
|
||||
script = ExtResource("2_uob21")
|
||||
|
||||
[node name="Timer" type="Timer" parent="." index="0" unique_id=801745901]
|
||||
7
Gameplay/Effects/passive_effect.tscn
Normal file
7
Gameplay/Effects/passive_effect.tscn
Normal file
@@ -0,0 +1,7 @@
|
||||
[gd_scene format=3 uid="uid://cudff465hbjhq"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://fygidhjkgabe" path="res://Gameplay/effect.tscn" id="1_yrp4s"]
|
||||
[ext_resource type="Script" uid="uid://jvk7ejpb7xnc" path="res://Gameplay/Effects/TimeEffect.cs" id="2_87klk"]
|
||||
|
||||
[node name="PassiveEffect" unique_id=110922950 instance=ExtResource("1_yrp4s")]
|
||||
script = ExtResource("2_87klk")
|
||||
11
Gameplay/Effects/time_effect.tscn
Normal file
11
Gameplay/Effects/time_effect.tscn
Normal file
@@ -0,0 +1,11 @@
|
||||
[gd_scene format=3 uid="uid://bi16tiewckt3c"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://fygidhjkgabe" path="res://Gameplay/effect.tscn" id="1_dhrm1"]
|
||||
[ext_resource type="Script" uid="uid://jvk7ejpb7xnc" path="res://Gameplay/Effects/TimeEffect.cs" id="2_v3kdq"]
|
||||
|
||||
[node name="TimeEffect" unique_id=110922950 instance=ExtResource("1_dhrm1")]
|
||||
script = ExtResource("2_v3kdq")
|
||||
|
||||
[node name="Timer" type="Timer" parent="." index="0" unique_id=801745901]
|
||||
|
||||
[connection signal="timeout" from="Timer" to="." method="OnTimerTimeout"]
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using Godot;
|
||||
|
||||
public static partial class Globals
|
||||
@@ -8,32 +9,6 @@ public static partial class Globals
|
||||
public static Random _rng = new();
|
||||
public static List<string> _addressTranslation = new(){"NW","N","NE","W","C","E","SW","S","SE"};
|
||||
|
||||
public static List<T> ShiftList<T>(List<T> LIST, int SHIFT_BY)
|
||||
{
|
||||
if (LIST.Count <= SHIFT_BY || LIST.Count == 0 || SHIFT_BY ==0)
|
||||
{
|
||||
return LIST;
|
||||
}
|
||||
int getRangeStart = SHIFT_BY < 0 ? -SHIFT_BY : LIST.Count - SHIFT_BY;
|
||||
int getRangeEnd = SHIFT_BY < 0 ? LIST.Count + SHIFT_BY : SHIFT_BY;
|
||||
int addRangeEnd = SHIFT_BY < 0 ? -SHIFT_BY : LIST.Count - SHIFT_BY;
|
||||
var result = LIST.GetRange(getRangeStart, getRangeEnd);
|
||||
result.AddRange(LIST.GetRange(0, addRangeEnd));
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void Shuffle<T>(IList<T> LIST)
|
||||
{
|
||||
int n = LIST.Count;
|
||||
while (n > 1) {
|
||||
n--;
|
||||
int k = _rng.Next(n + 1);
|
||||
T value = LIST[k];
|
||||
LIST[k] = LIST[n];
|
||||
LIST[n] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static void LoadSeed(int SEED)
|
||||
{
|
||||
_rng = new(SEED);
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using Godot;
|
||||
using Godot.NativeInterop;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public partial class Phone : Sprite2D
|
||||
{
|
||||
public bool _running = false;
|
||||
public PhoneButton _hoveredButton;
|
||||
public List<PhoneButton> _phoneButtons = new();
|
||||
public Player _player;
|
||||
@@ -21,12 +23,7 @@ public partial class Phone : Sprite2D
|
||||
{
|
||||
_phoneButtons[i]._phone = this;
|
||||
}
|
||||
_phoneButtons[0]._contact._action = new Example1();
|
||||
_phoneButtons[0]._contact.PassOwner(_player);
|
||||
_phoneButtons[0]._contact.SetTimer(1.5f);
|
||||
_phoneButtons[1]._contact._action = new Example2();
|
||||
_phoneButtons[1]._contact.PassOwner(_player);
|
||||
_phoneButtons[1]._contact.SetCooldown(15f);
|
||||
_phoneButtons[0]._contact.LoadEffect("time_effect_1", "TimeEffects");
|
||||
}
|
||||
|
||||
public override void _Process(double DELTA_)
|
||||
@@ -46,13 +43,19 @@ public partial class Phone : Sprite2D
|
||||
// _debug.Text = _loadedContact.GetType().ToString();
|
||||
// }
|
||||
|
||||
public virtual void HangUp()
|
||||
{
|
||||
_running = false;
|
||||
_phoneButtons.ForEach(b=>b._contact.End());
|
||||
|
||||
}
|
||||
|
||||
public void PassPlayer(Player PLAYER)
|
||||
{
|
||||
_player = PLAYER;
|
||||
for (int i = 0; i < _phoneButtons.Count; i++)
|
||||
{
|
||||
_phoneButtons[i]._phone = this;
|
||||
_phoneButtons[i]._contact.PassOwner(PLAYER);
|
||||
_phoneButtons[i]._contact.PassNumber((i+1)%10);
|
||||
}
|
||||
}
|
||||
@@ -62,4 +65,10 @@ public partial class Phone : Sprite2D
|
||||
// _loadedContact = null;
|
||||
// _debug.Text = "";
|
||||
}
|
||||
|
||||
public virtual void Start()
|
||||
{
|
||||
_running = true;
|
||||
_phoneButtons.ForEach(b=>b._contact.Start());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,24 +8,21 @@ public partial class PhoneButton : TextureButton
|
||||
public bool _isHovered = false;
|
||||
public Phone _phone;
|
||||
public Contact _contact;
|
||||
public ProgressBar _progressBar;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
_contact = GetNode<Contact>("Contact");
|
||||
_contact._button = this;
|
||||
_progressBar = GetNode<ProgressBar>("ProgressBar");
|
||||
}
|
||||
|
||||
public override void _Pressed()
|
||||
{
|
||||
base._Pressed();
|
||||
if (_contact._clickable)
|
||||
{
|
||||
_contact.CallAction();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// private void OnMouseEntered()
|
||||
// {
|
||||
// _isHovered = true;
|
||||
|
||||
@@ -86,7 +86,7 @@ public partial class Player : Actor
|
||||
{
|
||||
for (int i = 0; i < _phone._phoneButtons.Count; i++)
|
||||
{
|
||||
_phone._phoneButtons[i]._contact.Start();
|
||||
_phone.Start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,6 @@
|
||||
[gd_scene format=3 uid="uid://if21pf73w7by"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bgj2cuqdq0b6l" path="res://Gameplay/Contact.cs" id="1_basqx"]
|
||||
[ext_resource type="PackedScene" uid="uid://fygidhjkgabe" path="res://Gameplay/action.tscn" id="2_dg7ct"]
|
||||
|
||||
[node name="Contact" type="Sprite2D" unique_id=1143036413]
|
||||
script = ExtResource("1_basqx")
|
||||
|
||||
[node name="Timer" type="Timer" parent="." unique_id=879173975]
|
||||
|
||||
[node name="Cooldown" type="Timer" parent="." unique_id=1276257080]
|
||||
|
||||
[node name="Action" parent="." unique_id=110922950 instance=ExtResource("2_dg7ct")]
|
||||
|
||||
[connection signal="timeout" from="Timer" to="." method="OnTimerTimeout"]
|
||||
[connection signal="timeout" from="Cooldown" to="." method="OnCooldownTimeout"]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene format=3 uid="uid://fygidhjkgabe"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cac8dbhhcrjfe" path="res://Gameplay/Action.cs" id="1_lk435"]
|
||||
[ext_resource type="Script" uid="uid://cac8dbhhcrjfe" path="res://Gameplay/Effect.cs" id="1_lk435"]
|
||||
|
||||
[node name="Action" type="Node" unique_id=110922950]
|
||||
[node name="Effect" type="Node" unique_id=110922950]
|
||||
script = ExtResource("1_lk435")
|
||||
@@ -1,11 +1,11 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://dj6cr426bn30b"]
|
||||
[gd_scene format=3 uid="uid://dj6cr426bn30b"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://4hculjnuw6ha" path="res://Art/capsule-fill.svg" id="1_6ytam"]
|
||||
[ext_resource type="Script" uid="uid://cd1nniv27ef2f" path="res://Gameplay/PhoneButton.cs" id="1_d1byk"]
|
||||
[ext_resource type="PackedScene" uid="uid://if21pf73w7by" path="res://Gameplay/contact.tscn" id="3_3os1s"]
|
||||
|
||||
[node name="PhoneButton" type="TextureButton"]
|
||||
modulate = Color(1, 1, 1, 0.2)
|
||||
[node name="PhoneButton" type="TextureButton" unique_id=1734514874]
|
||||
clip_children = 2
|
||||
offset_right = 800.0
|
||||
offset_bottom = 800.0
|
||||
texture_normal = ExtResource("1_6ytam")
|
||||
@@ -15,6 +15,15 @@ texture_disabled = ExtResource("1_6ytam")
|
||||
texture_focused = ExtResource("1_6ytam")
|
||||
script = ExtResource("1_d1byk")
|
||||
|
||||
[node name="Contact" parent="." instance=ExtResource("3_3os1s")]
|
||||
[node name="Contact" parent="." unique_id=1509012205 instance=ExtResource("3_3os1s")]
|
||||
position = Vector2(-228, 230)
|
||||
scale = Vector2(0.13, 0.13)
|
||||
|
||||
[node name="ProgressBar" type="ProgressBar" parent="." unique_id=2023053611]
|
||||
layout_mode = 0
|
||||
offset_top = 117.0
|
||||
offset_right = 803.0
|
||||
offset_bottom = 712.0
|
||||
step = 1.0
|
||||
fill_mode = 3
|
||||
show_percentage = false
|
||||
|
||||
Reference in New Issue
Block a user