using Godot; using System; using System.Collections.Generic; using System.Linq; public partial class Phone : Sprite2D { public PhoneButton _hoveredButton; public List _phoneButtons = new(); public Player _player; public Contact _loadedContact; public CallButton _callButton; public RichTextLabel _debug; public override void _Ready() { _debug = GetNode("Debug"); _callButton = GetNode("CallButton"); _callButton._phone = this; _phoneButtons = GetChildren().Where(c=>c is PhoneButton).Cast().ToList(); for (int i = 0; i < _phoneButtons.Count; i++) { _phoneButtons[i]._phone = this; } _phoneButtons[0]._contact._action = new Example1(); _phoneButtons[0]._contact._action._owner = _player; _phoneButtons[0]._contact.SetTimer(1.5f); } public override void _Process(double DELTA_) { // _hoveredButton = _phoneButtons.FirstOrDefault(c => c._isHovered, null); } // public void CallLoadedContact() // { // _loadedContact.CallAction(); // ResetContact(); // } // public void LoadContact(Contact CONTACT) // { // _loadedContact = CONTACT; // _debug.Text = _loadedContact.GetType().ToString(); // } 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); } } public void ResetContact() { // _loadedContact = null; // _debug.Text = ""; } }