//private new Sprite graveMarker; // Use this for initialization void Start() { controller = GetComponent <GamePieceController>(); this.graveMarker = controller.graveMarker; stats = GetComponent <PawnStats>(); gameBoard = GetComponentInParent <Board>(); }
private void mergePieces() { print("merge"); GamePieceController pieceControl = populatedPiece.GetComponent <GamePieceController>(); foreach (CharacterClassBase piece in controller.selectedSpace.GetComponent <TerritoryHandler>().populatedPiece.GetComponent <GamePieceController>().pieces) { if (piece != null) { pieceControl.populateSlot(piece); } else { print("isNull"); } } controller.selectedSpace.GetComponent <TerritoryHandler>().destroyPiece(true); controller.selectedSpace.GetComponent <TerritoryHandler>().populatorFaction = TerritoryHolder.Neutral; controller.hasMergedPieces(); }
//HELPER FUNCTIONS private void createPiecePrefab() { if (populatedPiece == null) { populatedPiece = Instantiate(piecePrefab, new Vector3(this.transform.position.x, this.transform.position.y, -3), Quaternion.identity); } if (controller.playerTurn == PlayerTurn.Attack) { print("111"); populatorFaction = TerritoryHolder.Attack; GamePieceController pieceControl = populatedPiece.GetComponent <GamePieceController>(); pieceControl.populateSlot(controller.getUpNext()); } else { populatorFaction = TerritoryHolder.Defense; GamePieceController pieceControl = populatedPiece.GetComponent <GamePieceController>(); pieceControl.populateSlot(controller.getUpNext()); } }