public override void Awake() { base.Awake(); try { name = nameof(PWSelector); atlas = TextureUtil.Ingame; relativePosition = default; for (int row = 0; row < Forced.GetLength(0); ++row) { for (int col = 0; col < Forced.GetLength(1); ++col) { var tb = AddUIComponent <TB>(); tb.relativePosition = new Vector2(105 * col + 3, 30 * row + 3); tb.col = col; tb.row = row; } } color = Color.grey; backgroundSprite = "GenericPanelWhite"; FitChildren(new Vector2(3, 3)); } catch (Exception ex) { Log.Exception(ex); } }
/// <summary> /// Get a unique code that is equal for any two equal MurtyNodes. /// </summary> /// <returns>Hash code.</returns> public override int GetHashCode() { int hash = 17; hash = unchecked (37 * hash + Eliminated.GetHashCode()); hash = unchecked (37 * hash + Forced.GetHashCode()); if (Assignment != null) { hash = unchecked (37 * hash + Assignment.GetHashCode()); } return(hash); }
// gets ALL the forced Pices on the board private List <Forced> ScanForcedPossibleMove(Pices[,] pices, bool isWhiteTurn) { List <Forced> forceds = new List <Forced>(); // forcedPieces = new List<Pices>(); for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (pices[i, j] != null && pices[i, j].isWhite == isWhiteTurn) { if (pices[i, j].IsForceToMove(pices, i, j)) { // forcedPieces.Add(pices[i, j]); Forced f = new Forced(pices[i, j], i, j); forceds.Add(f); } } } } return(forceds); }
public void Force(IForceable forceable) { forceable.ApplyForce(new ForceArgs(Origin, gameObject, ForceDirection * force)); Forced?.Invoke(this); }