public CatController(Graphics g, int cellSize, Cell[,] map, GameBoard parentForm, MouseController mouse) { CurPos.pixX += (cellSize / 4 + 1); CurPos.pixY += +(cellSize / 4 + 1); this.moveDistance = this.cellSize = cellSize; this.g = g; this.map = map; f = parentForm; LoadMouseImage(); DrawCat(g); this.mouse = mouse; lastMove = MoveUp; Collisions += new CollisionCheck(CheckCollision); t.Enabled = true; t.Interval = 300; t.Tick += new System.EventHandler(Move); t.Start(); }
public void Start() { spelplan = GameObject.Find("Spelplan"); characterAnimations = GameObject.Find("PlayerMary").GetComponent <CharacterAnimations>(); enemyAnimations = GameObject.Find("PlayerEnemy").GetComponent <EnemyAnimations>(); rewardScreen = GameObject.Find("PController").GetComponent <RewardScreen>(); lastMove = GameObject.Find("PController").GetComponent <LastMove>(); hellStaff = GameObject.Find("PController").GetComponent <HellStaff>(); darknightStaff = GameObject.Find("PController").GetComponent <DarkNightStaff>(); moonStaff = GameObject.Find("PController").GetComponent <MoonStaff>(); skeletonStaff = GameObject.Find("PController").GetComponent <SkeletonStaff>(); pumpkinStaff = GameObject.Find("PController").GetComponent <PumpkinStaff>(); mirrorStaff = GameObject.Find("PController").GetComponent <MirrorStaff>(); playerTurn = 0; marysHealth = marysMaxHealth; enemyHealth = enemyMaxHealth; firstTurn = true; Marks(playerMarks, enemyMarks); pumpkinStaff.PumpkinStaffPassiveAbility(); lastMove.staffUsed = true; }
private LastMove GetLastMove() { //this method compares the previous board to the current board // and returns the actual move. For use in determining if en passant pawn // capture is valid. int pos = 1; var pb = this.MyLastMove.ToCharArray(); var tb = this.OpponentsMove.ToCharArray(); var fromto = pb.Zip(tb, (BegPiece, EndPiece) => new { BegPiece, EndPiece, Position = pos++ }) .Where(r => r.BegPiece != r.EndPiece) //.Select(r=> r.Position) .ToList(); ; var begPos = fromto.First(); var endPos = fromto.Last(); var from = fromto.Where(i => i.BegPiece == '.' || i.EndPiece == '.').First(); LastMove lm = new LastMove(); lm.Beg = Global.BoardMap.Where(bm => bm.Pos == begPos.Position).Single(); lm.End = Global.BoardMap.Where(bm => bm.Pos == endPos.Position).Single(); lm.Piece = from.BegPiece == '.' ? from.EndPiece : from.BegPiece; return(lm); }
private void MoveRight() { //check the next cell over is one that can be moved into if (IsValidCell(map[CurPos.cellX + 1, CurPos.cellY].CellType)) { CurPos.cellX += 1; CurPos.pixX = (CurPos.cellX * cellSize); lastMove = MoveRight; } }
private void MoveLeft() { if (IsValidCell(map[CurPos.cellX - 1, CurPos.cellY].CellType)) { CurPos.cellX -= 1; CurPos.pixX = (CurPos.cellX * cellSize); lastMove = MoveLeft; } }
private void MoveDown() { if (IsValidCell(map[CurPos.cellX, CurPos.cellY + 1].CellType)) { CurPos.cellY += 1; CurPos.pixY = (CurPos.cellY * cellSize); lastMove = MoveDown; } }
private void MoveUp() { if (IsValidCell(map[CurPos.cellX, CurPos.cellY - 1].CellType)) { CurPos.cellY -= 1; CurPos.pixY = (CurPos.cellY * cellSize); lastMove = MoveUp; } }
public void ClearLastMoves() { for (int player = 0; player < 3; player++) { for (int pawn = 0; pawn < 5; pawn++) { LastMoves[player, pawn] = new LastMove(); } } }
void Start() { tile = GetComponent <SpriteRenderer>(); gc = GameObject.FindGameObjectWithTag("Player"); gameControl = gc.GetComponent <GameControl>(); neutral = Resources.Load <Sprite>("Sprites/Board_Tile"); Spelplan = GameObject.FindGameObjectWithTag("Spelplan"); lastMove = GameObject.Find("PController").GetComponent <LastMove>(); mirrorStaffHighlight = GameObject.Find("PlayerButtons/StaffButton").GetComponent <MirrorStaffHighlight>(); }
void Awake() { spelplan = GameObject.FindGameObjectWithTag("Spelplan"); lastMove = GameObject.Find("PController").GetComponent <LastMove>(); abilityButton = GameObject.Find("Buttons/PlayerButtons/StaffButton").GetComponent <Button>(); abilityButton.onClick.AddListener(StaffPower); gameControl = GameObject.Find("PController").GetComponent <GameControl>(); }
public HtmlString RenderLastMoveAsArray() { if (LastMove == null) { return(new HtmlString("null")); } else { return(new HtmlString(string.Format("[\"{0}\",\"{1}\"]", LastMove.Substring(0, 2), LastMove.Substring(2, 2)))); } }
public string GetPath() { string path = String.Empty; if (Parent == null) { return(path); } path += Parent.GetPath() + LastMove.ToString()[0]; return(path); }
void Start() { abilityButton = GameObject.Find("Buttons/PlayerButtons/StaffButton").GetComponent <Button>(); abilityButton.onClick.AddListener(HellStaffActiveAbility); gameControl = GameObject.Find("PController").GetComponent <GameControl>(); lastMove = GameObject.Find("PController").GetComponent <LastMove>(); if (DataAcrossScenes.EnemyChosenStaff == (int)Chosen_Staff.hell) { gameControl.enemyMaxHealth = 30; gameControl.enemyHealth = 30; } }
private IEnumerator DoGoTo(List <EnvironmentTile> route, bool finishLastMove) { mAnimator.SetBool("IsHarvesting", false); // If the player switches the tile to move to, finish the last move off first if (finishLastMove) { yield return(DoMove(mLastMove.start, mLastMove.destination.Position, true, mLastMove.t)); CurrentPosition = mLastMove.destination; } // Move through each tile in the given route if (route != null) { Vector3 position = CurrentPosition.Position; for (int count = 0; count < route.Count; ++count) { Vector3 next = route[count].Position; NextTile = route[count]; mLastMove = new LastMove { start = position, destination = route[count], t = 0.0f }; yield return(DoMove(position, next, route[count].IsAccessible)); CurrentPosition = route[count]; position = next; } // Finished path, check task if (Task != null) { switch (Task.Type) { case EMoveTask.Harvest: ExecuteHarvestTask(position); break; } Task = null; } else { State = EState.Idle; } } }
public bool Equals(State other) { if (ReferenceEquals(null, other)) { return(false); } // if (ReferenceEquals(this, other)) return true; return(LastMove.Equals(other.LastMove) && Key.Equals(other.Key) && PawnStructureKey.Equals(other.PawnStructureKey) && EnPassantSquare.Equals(other.EnPassantSquare) && CastlelingRights == other.CastlelingRights && NonPawnMaterial.First() == other.NonPawnMaterial.First() && NonPawnMaterial.Last() == other.NonPawnMaterial.Last() && PliesFromNull == other.PliesFromNull && Rule50 == other.Rule50 && Pinners.Equals(other.Pinners) && Checkers.Equals(other.Checkers) && CapturedPiece == other.CapturedPiece && Equals(Previous, other.Previous)); }
/// <summary> /// 直前の試合の結果文字列。(IncResult()したときの情報に基づく) /// </summary> /// <returns></returns> public string GetGameResultStringForLastGame() { // セットされていない? if (LastMove == Move.NONE) { return(null); } switch (LastGameResult) { case MoveGameResult.WIN: return(Handicapped ? "下手勝ち" : "先手勝ち"); case MoveGameResult.LOSE: return(Handicapped ? "上手勝ち" : "後手勝ち"); case MoveGameResult.DRAW: return("引き分け"); case MoveGameResult.UNKNOWN: return(LastMove.SpecialMoveToKif()); default: return(null); } }
public void Move_to_x(int x) { if (x > 1600 - position.Width - 25) { position.X = 1600 - position.Width - 25; } else if (x < 25) { position.X = 25; } else { if (x < position.X) { lastMove = LastMove.LEFT; } else { lastMove = LastMove.RIGHT; } position.X = x; } }
public void Move_to_x(int x) { if (x > SquashGame.WINDOW_WIDTH - position.Width) { position.X = SquashGame.WINDOW_WIDTH - position.Width; } else if (x < 0) { position.X = 0; } else { if (x < position.X) { lastMove = LastMove.LEFT; } else { lastMove = LastMove.RIGHT; } position.X = x; } }
private void Awake() { spelplan = GameObject.FindGameObjectWithTag("Spelplan"); lastmove = GameObject.Find("PController").GetComponent <LastMove>(); gameControl = GameObject.Find("PController").GetComponent <GameControl>(); }
public override string ToString() { return("FromRoot : {0}, LastMove: {1}".ToFormat(MovesFromRoot.ToString(), LastMove.ToString())); }
public IBoard Move(IMove move) { IBoard result = this.Clone() as Board; IPiece pieceToMove = result.GetFigureAt(move.Start); IPiece attackedPiece = result.GetFigureAt(move.Destination); if (!AreAnyPiecesBetwen(move.Start, move.Destination)) { if (attackedPiece == null) { if (pieceToMove.IsAllowedMove(move)) { pieceToMove.Move(move.Destination); if (!result.IsCheck(pieceToMove.color)) { result.LastMove = move; return(result); } } else if (pieceToMove.Type == PiecesTypesEnum.Pawn && pieceToMove.IsAllowedCapture(move)) { IPiece lastMovedPiece = result.GetFigureAt(LastMove.Destination); if (lastMovedPiece.Type == PiecesTypesEnum.Pawn && LastMove.Distance() == DistanceEnum.TwoSquares && (LastMove.Destination.x == move.Start.x - 1 || LastMove.Destination.x == move.Start.x + 1) && LastMove.Destination.y == move.Start.y) { result.RemovePiece(lastMovedPiece); pieceToMove.Move(move.Destination); if (!result.IsCheck(pieceToMove.color)) { result.LastMove = move; return(result); } } } else if (pieceToMove.Type == PiecesTypesEnum.King) { IKing king = pieceToMove as IKing; List <IMove> moves = king.Castling(move, result); if (moves != null) { foreach (var item in moves) { result.GetFigureAt(item.Start).Move(item.Destination); } if (!result.IsCheck(pieceToMove.color)) { result.LastMove = move; return(result); } } } } else if (attackedPiece.color != pieceToMove.color) { if (pieceToMove.IsAllowedCapture(move)) { result.RemovePiece(attackedPiece); pieceToMove.Move(move.Destination); if (!result.IsCheck(pieceToMove.color)) { result.LastMove = move; return(result); } } } } return(null); }