first commit
This commit is contained in:
95
Player.cs
Normal file
95
Player.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
|
||||
public partial class Player : Actor
|
||||
{
|
||||
public bool _isTurn = false;
|
||||
public string _name;
|
||||
public Phone _phone;
|
||||
public Boss _boss;
|
||||
public Enemy _activeEnemy;
|
||||
public RichTextLabel _debug;
|
||||
public List<BusinessCard> _businessCards;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
|
||||
_debug = GetNode<RichTextLabel>("Debug");
|
||||
|
||||
_phone = GetNode<Phone>("Phone");
|
||||
_phone.PassPlayer(this);
|
||||
|
||||
_boss = GetNode<Boss>("Boss");
|
||||
_boss.PassPlayer(this);
|
||||
|
||||
_businessCards = GetChildren().Where(c=>c is BusinessCard).Cast<BusinessCard>().ToList();
|
||||
for (int i = 0; i < _businessCards.Count; i++)
|
||||
{
|
||||
_businessCards[i].PassPlayer(this);
|
||||
_businessCards[i].AssignGoal(GoalName.MiddleColumn);
|
||||
}
|
||||
|
||||
|
||||
Challenge(_boss);
|
||||
}
|
||||
|
||||
public void Challenge(Enemy ENEMY)
|
||||
{
|
||||
_board?.Deactivate();
|
||||
ENEMY._board.Activate();
|
||||
_board = ENEMY._board;
|
||||
_activeEnemy = ENEMY;
|
||||
|
||||
string text = "";
|
||||
if (_activeEnemy is Mook)
|
||||
{
|
||||
text = "dragon " + _activeEnemy._owner._number + "\nmook " + _activeEnemy._number;
|
||||
}
|
||||
else if (_activeEnemy is Dragon)
|
||||
{
|
||||
text = "dragon " + _activeEnemy._number;
|
||||
}
|
||||
_debug.Text = text;
|
||||
}
|
||||
|
||||
public void CheckBusinessCards()
|
||||
{
|
||||
_businessCards.ForEach(b=>b.CheckGoal());
|
||||
}
|
||||
|
||||
// public bool CheckWin(List<Cell> CELLS)
|
||||
// {
|
||||
// foreach (Goal.GoalName cond in _goal._eligibleGoals)
|
||||
// {
|
||||
// foreach (List<int> condList in _goal._conditions[cond])
|
||||
// {
|
||||
// // if (condList.All(a=>CELLS.FirstOrDefault<Cell>(c=>c._address == a, null)?._owner == this))
|
||||
// // {
|
||||
// // return true;
|
||||
// // }
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
// public void MarkCell(Cell CELL)
|
||||
// {
|
||||
// CELL._mark.Texture = _mark.Texture;
|
||||
// // CELL._owner = this;
|
||||
// }
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (Input.IsActionJustReleased("backspace"))
|
||||
{
|
||||
if (_board._owner._owner != null)
|
||||
{
|
||||
Challenge(_board._owner._owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user