first commit
This commit is contained in:
47
Gameplay/BusinessCard.cs
Normal file
47
Gameplay/BusinessCard.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
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>("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<Cell> ownedCells = _player._board.GetCellsByOwner(_player);
|
||||
List<int> 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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user