using Godot; using System; using System.Collections.Generic; using System.Linq; public partial class BusinessCard : TextureButton { public Player _player; public Goal _goal; public GoalName _goalName; public bool _goalMet = false; public override void _Ready() { base._Ready(); _goal = GetNode("Goal"); } public override void _Pressed() { base._Pressed(); GD.Print("Pressed"); _player._activeEnemy.Defeat(_goalName); _player.Challenge(_player._activeEnemy._owner._board._owner); } public void AssignGoal(GoalName GOALNAME) { _goalName = GOALNAME; } public void CheckGoal() { List ownedCells = _player._board.GetCellsByOwner(_player); List addresses = _goal.GetAddresses(_goalName); _goalMet = addresses.All(a=>ownedCells.Select(c=>c._address).ToList().IndexOf(a)>-1); GD.Print(_goalMet); Disabled = !_goalMet; GD.Print(Disabled); } public void PassPlayer(Player PLAYER) { _player = PLAYER; } }