// Use this for initialization void Start() { lives = 3; round = 1; boardController = GameObject.FindGameObjectWithTag ("Ground").GetComponent<BoardController> (); ballController = GameObject.FindGameObjectWithTag ("Ball").GetComponent<BallController> (); }
void Awake() { // Making sure there's no existing board if (boardHolder != null) Destroy (boardHolder); // Create a new board and find required scripts boardHolder = Instantiate (boardManager); boardScript = boardHolder.GetComponent<BoardController>(); cardSlotScript = slotHolder.GetComponent<CardSlotManager> (); // Determine if we're running a tutorial or a multiplayer game. Will eventually require support for multiple game modes // --> use switch() and unique game mode managers if (tutorial) { // Start the tutorial tutorialScript = tutorialManager.GetComponent<TutorialController>(); tutorialScript.StartTutorial(); } else { // Starting a new multiplayer game boardScript.StartGame (); // Update Cardslots to reflect player colours cardSlotScript.ChangeSlotColours(PlayerColour.Instance.redSheep); } }
public void PutBoardUpdatesBoard() { var controller = new BoardController(); var board = new Board() { Questions = new List<Question> { new Question() { Answers = new List<Answer> { new Answer { Text = "A1" }, new Answer { Text = "A2" } }, Text = "Question 1", Order = 1 } }, Name = "Board Name" }; controller.PostBoard(board); }
public override void Initialize(BaseController _tokenController) { m_tokenController = (TokenController)_tokenController; m_tokenController.GetModel().OnTokenMoved += OnTokenMoved; m_tokenController.GetModel().OnTokenTeleported += OnTokenTeleported; m_boardController = GameObject.FindObjectOfType<BoardController>(); base.Initialize(_tokenController); }
//diagonal public override List<Position> getAvailableSpaces(BoardController board) { List<Position> availableMoves = new List<Position>(); availableMoves.Add(this.position.move(1,1)); availableMoves.Add(this.position.move(1,-1)); availableMoves.Add(this.position.move(-1,-1)); availableMoves.Add(this.position.move(-1,1)); return availableMoves; }
public bool positionIsInRange(BoardController board, Position newPos) { foreach(Position availPos in getAvailableSpaces(board)) { if(availPos.x == newPos.x && availPos.y == newPos.y) { return true; } } return false; }
public override void Initialize(BaseController _boardController) { m_boardController = (BoardController)_boardController; m_TilesView = new List<TileView>(); m_StairsView = new List<StairView>(); m_slideView = new List<SlideView>(); SetupAllTilesView(); SetupAllStairsView(); SetupAllSliderView(); base.Initialize(_boardController); }
void Start() { board = GameObject.Find("Board").GetComponent<BoardController>(); board.driver = this.gameObject; InitShowControls(); scAttack.Show(); player = GameObject.Find("Player").GetComponent<PlayerController>(); player.canCharge = false; player.driver = gameObject; enemies = GameObject.FindObjectsOfType(typeof(TinyEnemyController)) as TinyEnemyController[]; }
void Awake() { Instantiate<GameObject>(boardManager); var boardController = new BoardController(); boardController.PreInit(); boardController.Load(); boardController.Init(); Instantiate(Resources.Load<GameObject>("Prefabs/3D/mouse_tank"), Vector3.zero, Quaternion.identity); }
void Awake () { if(Instance != null && Instance != this) { DestroyImmediate(gameObject); return; } Instance = this; DontDestroyOnLoad(gameObject); boardController = GetComponent<BoardController>(); enemies = new List<Enemy>(); }
public MainWindow() { InitializeComponent(); InitalizeWindow(); InitalizeGrid(); boardController = new BoardController(BoardXML); InitalizeSquare(); }
void Awake() { if (Instance != null && Instance != this) { DestroyImmediate(gameObject); return; } //Screen.SetResolution(640, 480, true); Instance = this; DontDestroyOnLoad (gameObject); boardController = GetComponent<BoardController> (); enemies = new List<Enemy> (); }
void OnEnable() { boardController = new BoardController(); path = boardController.GetPath(new Index(0, 3), new Index(29, 32)); transform.position = boardController.GetCellPosition(new Index(0, 3)); var targetCellPos = boardController.GetCellPosition(path.First<Index>()); var direction = targetCellPos - transform.position; direction.Normalize(); transform.rotation = Quaternion.LookRotation(direction); }
public void move(BoardController board, bool movePlayer1) { Model.State state = getState (board, movePlayer1); if(state.isTerminal) { Debug.Log("AI Not moving; game is over!"); return; } Model.Action act = strat.getAction(state); PieceController mover = getPiece(board, act); PieceController captured = board.getTile(act.newPos).myPiece; if(captured != null) { Debug.Log("AI Moving player "+mover.model.playerNum+"'s "+ mover.model.color+" piece at (" + mover.model.position.x+","+mover.model.position.y+") " +" to capture player "+captured.model.playerNum+"'s "+captured.model.color+" piece at ("+captured.model.position.x+","+captured.model.position.y+")."); board.combine(mover, captured); } else { Debug.Log("AI Moving player "+mover.model.playerNum+"'s "+ mover.model.color+" piece at (" + mover.model.position.x+","+mover.model.position.y+") " +" to ("+act.newPos.x+","+act.newPos.y+")."); mover.move(act.newPos); } }
/// <summary> /// Консольный интерфейс добавления задач. /// </summary> /// <param name="boardController"></param> protected static void AddTaskToBoard(BoardController boardController, IPusher pusher) { Console.Clear(); var nameTask = TryParseName("задачи"); var date = TryParseDate(); var priority = TryParsePriority(); if (pusher == null) { throw new ArgumentNullException("Следует передать интерфейс добавления задачи!"); } try { pusher.AddTask(boardController, new Task(nameTask, date, priority)); } catch (ArgumentException ex) { Console.Error.WriteLine(ex.Message); } }
public BoardController GetBoardController() { if (_boardController != null) { return(_boardController); } else { if (_board != null) { _boardController = new BoardController(_board); return(_boardController); } else { GenerateBoard(); _boardController = new BoardController(_board); return(_boardController); } } }
private void Awake() { // Singleton setup for GameManager if (Instance == null) { //DontDestroyOnLoad(gameObject); // comment out singleton to goto menu Instance = this; } else if (Instance != this) { Destroy(gameObject); } PlayerController = GetComponent <PlayerController>(); MoneyController = GetComponent <MoneyController>(); CorporationController = GetComponent <CorporationController>(); TileController = GetComponent <TileController>(); BoardController = GetComponent <BoardController>(); HudController = GetComponent <HudController>(); MainMenuController = GetComponent <MainMenuController>(); }
public void BoardControllerEnsureListOfUserBoards() { // Arrange List <Board> data_store_boards = new List <Board> { new Board { Title = "My Awesome Board", BoardId = 1, Owner = owner }, new Board { Title = "My Grocery Board", BoardId = 2, Owner = owner } }; BoardController controller = new BoardController(mock_repository.Object); mock_repository.Setup(r => r.GetAllBoards()).Returns(data_store_boards); // Act ViewResult result = controller.Index() as ViewResult; // Assert CollectionAssert.AreEqual(data_store_boards, result.ViewBag.Boards); }
private void SwitchPiece(int indexToSwitchTo) { AvailableWoodMaterial[currentPieceIndex].transform.position = Vector3.zero; AvailableWoodMaterial[currentPieceIndex].transform.rotation = Quaternion.identity; AvailableWoodMaterial[currentPieceIndex].SetActive(false); currentPieceIndex = indexToSwitchTo; AvailableWoodMaterial[currentPieceIndex].SetActive(true); currentBoardController = AvailableWoodMaterial[currentPieceIndex].GetComponent <BoardController>(); if (currentAction == ActionState.OnSaw || (previousAction == ActionState.OnSaw && currentAction == ActionState.ChangingCamera)) { EnableCurrentBoardMovement(true); RestrictCurrentBoardMovement(false, false); PlacePieceAtSpawnPoint(new Vector3(0.0f, 0.0f, -3.0f)); } else if (currentAction == ActionState.UsingRuler || (previousAction == ActionState.UsingRuler && currentAction == ActionState.ChangingCamera)) { EnableCurrentBoardMovement(false); PlacePieceAtSpawnPoint(new Vector3(-3.0f, 0.0f, 0.0f)); } }
private void OnCombatEnd(bool suicide = false, bool draw = false) { UnitCard winner = attackingUnit; UnitCard loser = defendingUnit; if (draw) //they both died { winner = null; loser = null; } if (suicide) //swap winner and loser { winner = defendingUnit; loser = attackingUnit; } if (winner != null) { LogWindow.Log("Combat Ended! " + winner.name + " is victorious!"); } else { LogWindow.Log("Combat Ended! No one came out victorious!"); } gameObject.SetActive(false); location.OnCombatEnd(winner, loser); player1Card.OnCombatEnd(); player2Card.OnCombatEnd(); GameController.GetPlayerController(PlayerInfo.PLAYER1).OnCombatEnd(); GameController.GetPlayerController(PlayerInfo.PLAYER2).OnCombatEnd(); BoardController.OnCombatEnd(winner); GameController.OnCombatEnd(); }
public void TestPiecePositions() { GameObject b = new GameObject(); Piece p = b.AddComponent <Piece>(); BoardController c = b.AddComponent <BoardController>(); BoardPreparator prep = b.AddComponent <BoardPreparator>(); prep.setTestData(p); c.setTestData(prep); float x = 10; float y = 5; b.transform.position = new Vector2(x, y); Assert.AreEqual(p.GetXPosition(), x); Assert.AreEqual(p.GetYPosition(), y); int x2 = 15; int y2 = 15; p.MoveTo(x2, y2); Assert.AreEqual(p.GetXPosition(), x2); Assert.AreEqual(p.GetYPosition(), y2); }
void Start() { orbitCamera = GameCamera.GetComponent <OrbitCamera>(); numberOfCuts = DadosToCut.Count; UI_Manager.DisplayPlans(true); StillCutting = true; BladeControl.Moveable = false; foreach (GameObject go in AvailableWoodMaterial) { go.SetActive(false); } foreach (DadoBlock dadoBlock in DadosToCut) { MeshRenderer meshRenderer = dadoBlock.GetComponent <MeshRenderer>(); meshRenderer.material.color = Color.white; } AvailableWoodMaterial[currentPieceIndex].SetActive(true); currentBoardController = AvailableWoodMaterial[currentPieceIndex].GetComponent <BoardController>(); UI_Manager.UpdateSelectionButtons(currentPieceIndex, AvailableWoodMaterial.Count); SetupForCutting(); }
private void SwitchPiece(int indexToSwitchTo) { MiterGauge.HideMiterGauge(); AvailableWoodMaterial[currentPieceIndex].transform.position = Vector3.zero; AvailableWoodMaterial[currentPieceIndex].transform.rotation = Quaternion.Euler(0.0f, 90.0f, 0.0f); AvailableWoodMaterial[currentPieceIndex].SetActive(false); currentPieceIndex = indexToSwitchTo; AvailableWoodMaterial[currentPieceIndex].SetActive(true); currentBoardController = AvailableWoodMaterial[currentPieceIndex].GetComponent <BoardController>(); if (currentAction == ActionState.OnSaw || previousAction == ActionState.OnSaw) { EnableCurrentBoardMovement(true); RestrictCurrentBoardMovement(false, false); } else if (currentAction == ActionState.UsingRuler || previousAction == ActionState.UsingRuler) { EnableCurrentBoardMovement(false); } MiterGauge.WoodMaterial = AvailableWoodMaterial[currentPieceIndex].GetComponent <Rigidbody>(); PlacePiece(); }
public void GetResult_WhenTurtleInExit_ShouldReturnSuccess() { var exitPoint = new Point { X = 0, Y = 1 }; var gameSettings = new GameSettingsBuilder() .WithStartingPositionDirection(Directions.North) .WithStartingPositionX(0) .WithStartingPositionY(0) .WithExitPoint(exitPoint) .Build(); var sut = new BoardController(gameSettings); sut.MoveTurtle(); var result = sut.GetResult(); Assert.Equal(MovesResultPossibilities.Success, result); }
private void LoadObjects() { if (player == null) { player = GameObject.Find("Player").GetComponent <PlayerController>(); } if (board == null) { board = GameObject.Find("Board").GetComponent <BoardController>(); } if (frontground == null) { frontground = GameObject.Find("Frontground").GetComponent <Image>(); } if (winSoundPlayer == null) { winSoundPlayer = GameObject.Find("Win Sound Player").GetComponent <WinSoundPlayer>(); } }
void Update() { if (playerMove) { MovePlayer(); } if (!gameOver) { CheckPlayerTimeOutToOver(); } //Vegetable Picking if (Input.GetKeyDown(PickKey) && isTrigger && selectedObject.tag == "Veg") { PickVegetableFromTable(); } //Picking Final Salad From Cjopping Board else if (Input.GetKeyDown(PickKey) && isTrigger && selectedObject.tag == "Board" && playerMove) { BoardController boardController = selectedObject.GetComponent <BoardController>(); InstantiateVegetableFromBoard(boardController.boardId); } // Drop To Board else if (Input.GetKeyDown(DropKey) && isTrigger && selectedObject.tag == "Board" && playerMove) { BoardController boardController = selectedObject.GetComponent <BoardController>(); DropToBoard(boardController.boardId, selectedObject); } //Drop or Devlivering Salad To Customer else if (Input.GetKeyDown(DropKey) && isTrigger && selectedObject.tag == "Customer") { CustomerController customerController = selectedObject.GetComponent <CustomerController>(); DropToCustomerPlate(customerController.customerId); } }
//Awake is always called before any Start functions void Awake() { //Check if instance already exists if (instance == null) { //if not, set instance to this instance = this; } //If instance already exists and it's not this: else if (instance != this) { //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager. Destroy(gameObject); } //Get a component reference to the attached BoardManager script board = GetComponent <BoardController>(); //Call the InitGame function to initialize the first level board.InitGame(); }
public void DelSubTaskTest() { // Arrange var nameBoard = Guid.NewGuid().ToString(); var nameTask = "Name"; var data = DateTime.Parse("01.01.2023"); var nameSubTask = "NameSubTask"; // Act var controller = new BoardController(nameBoard); controller.AddTask(new Model.Task(nameTask, data)); var task = controller.Tasks.First(t => t.Name == nameTask); controller.AddSubTask(task, new Task(nameSubTask, data)); controller.DelSubTask(task, nameSubTask); var controller2 = new BoardController(nameBoard); // Assert Assert.IsNull(controller2.GetSubTasks(task)); Assert.ThrowsException <ArgumentNullException>(() => controller2.DelSubTask(task, nameSubTask)); }
public FrmSolitaireGUI(FrmSolitaire Invoker) { InitializeComponent(); LoadCards(); BoardController = new BoardController(); Logic = new SolitaireLogicComponent(StateController, BoardController); originalSize = this.Size; ResizeBuffer(this.Width, this.Height); Resize += (s, e) => ResizeBuffer(((Form)s).Width, ((Form)s).Height); new Thread(() => { while (true) { Thread.Sleep(15); Draw(); } }).Start(); Invoker.OnScanComplete += Invoker_OnScanComplete; }
public void AddTaskTest() { // Arrange var nameBoard = Guid.NewGuid().ToString(); var nameTask = "Name"; var data = DateTime.Parse("01.01.2023"); // Act var controller = new BoardController(nameBoard); controller.AddTask(new Model.Task(nameTask, data)); var controller2 = new BoardController(nameBoard); var task = controller.Tasks.First(); // Assert Assert.IsNull(task.ExecutorsNik); Assert.AreEqual(task.DeadLine, data); Assert.AreEqual(task.Name, nameTask); Assert.AreEqual(task.Priority, Model.Priority.P4); Assert.AreEqual(task.Status, Model.Status.NotPerformed); Assert.IsNull(task.SubTasks); Assert.ThrowsException <ArgumentException>(() => controller.AddTask(new Model.Task(nameTask, data))); }
private IEnumerator SeekerCharge(BoardController board, Action after, SubHUDSprite seeker, Vector2 start, Vector2 end) { yield return(0.6f); float speed = -6; while ((start - end).Sign().Equals((seeker.Position - end).Sign())) { CheckSeekerCollision(board, seeker); speed = Calc.Approach(speed, 26f, 30f * Engine.DeltaTime); seeker.Position += speed * (end - start).SafeNormalize(); yield return(null); } while (speed > 0.5) { CheckSeekerCollision(board, seeker); speed = Calc.Approach(speed, 0, 40f * Engine.DeltaTime); seeker.Position += speed * (end - start).SafeNormalize(); yield return(null); } seeker.sprite.Play("takeHit"); seeker.sprite.OnLoop = s => { seeker.RemoveSelf(); after(); }; }
public GameplayController( Gameplay gameplay, Hud hud, PauseView pauseView, SummaryView summaryView, PenaltyView penaltyView, BonusView bonusView, Board board, BoardController boardInputController, LevelIntroView levelIntroView, TutorialView tutorialView) { m_gameplay = gameplay; m_hud = hud; m_pauseView = pauseView; m_summaryView = summaryView; m_penaltyView = penaltyView; m_bonusView = bonusView; m_board = board; m_levelIntroView = levelIntroView; m_boardInputController = boardInputController; m_tutorialView = tutorialView; }
// Use this for initialization void Awake() { if (Instance != null) { return; } Instance = this; pieceToGameObjectMap = new Dictionary <Piece, GameObject>(); boardController = BoardController.Instance; board = boardController.Board; for (int i = 0; i < board.Pieces.Count; i++) { Piece piece = board.Pieces[i]; GameObject pieceGO = new GameObject(); pieceGO.name = piece.GetType().FullName; pieceGO.transform.SetParent(this.transform); pieceGO.transform.position = new Vector3(piece.Tile.C, piece.Tile.R); pieceGO.AddComponent <SpriteRenderer>(); pieceToGameObjectMap.Add(boardController.Board.Pieces[i], pieceGO); } }
// Use this for initialization void Start() { Board = GameObject.Find("Board").GetComponent <BoardController>(); Started = false; TurnLength = 1.0f; TurnButton = GameObject.Find("TurnButton").GetComponent <Button>(); ButtonText = GameObject.Find("ButtonText").GetComponent <Text>(); TimerText = GameObject.Find("TimerText").GetComponent <Text>(); TimerText.text = TurnLength.ToString(); GameOverText = GameObject.Find("GameOverText").GetComponent <Text>(); PlayerTurnText = GameObject.Find("PlayerTurnText").GetComponent <Text>(); BlockBoard = GameObject.Find("BlockBoard"); NeedNewBoard = false; NeedNewCards = 20; TurnCount = 0; FirstTurn = true; MatchTurn = true; CurrentPlayer = P1; OtherPlayer = P2; }
// TODO : Frozen, Silenced, DivineShield, Taunt, etc... renderers/overlays public static MinionController Create(BoardController parentBoard, Minion minion) { // Creating a new GameObject to hold all the components GameObject minionObject = new GameObject(minion.Card.Name); minionObject.transform.ChangeParent(parentBoard.transform); // Adding a BoxCollider to the GameObject BoxCollider collider = minionObject.AddComponent <BoxCollider>(); collider.size = new Vector3(2.5f, 3.5f, 0.5f); // Adding a MinionController to the GameObject MinionController minionController = minionObject.AddComponent <MinionController>(); minionController.Minion = minion; minionController.Collider = collider; // Initializing the MinionController minionController.Initialize(); return(minionController); }
public void MoveSelectedPiece_SelectedPoint_PieceMovedRaised( int pointCount, int newPointModelIndex, int stubPointModelIndex, int pointIndex, int neightborIndex, int expectedCallCount) { // Arrange var stubPoints = TestHelper.CreatePointsWithBounds(pointCount); stubPoints[pointIndex].Neighbors = new List <PointModel> { stubPoints[neightborIndex] }; var stubBoardService = Substitute.For <IBoardService>(); stubBoardService.CreateInitialBoard() .Returns(new Tuple <List <PointModel>, List <List <PointModel> > >(stubPoints, null)); var stubBoardModel = Substitute.For <BoardModel>(stubBoardService); var mockEventSubscriber = new MockEventSubscriber(); stubBoardModel.NewPieceAdded += mockEventSubscriber.Handle; stubBoardModel.SelectionChanged += mockEventSubscriber.Handle; stubBoardModel.PieceMoved += mockEventSubscriber.Handle; var stubPlayer = Substitute.For <PlayerModel>(1, Colors.Yellow); var boardController = new BoardController(stubBoardModel); boardController.AddNewPiece(stubPoints[stubPointModelIndex], stubPlayer); boardController.ChangeSelection(stubPoints[stubPointModelIndex], stubPlayer, true); mockEventSubscriber.Reset(); // Act boardController.MoveSelectedPiece(stubPoints[newPointModelIndex]); // Assert Assert.AreEqual(expectedCallCount, mockEventSubscriber.HitCount); }
public void MoveSelectedPiece_ValidSelectedPoint_PieceIsMovedToCorrectPoint() { // Arrange var stubPoints = TestHelper.CreatePointsWithBounds(5); stubPoints[2].Neighbors = new List <PointModel> { stubPoints[3] }; var stubBoardService = Substitute.For <IBoardService>(); stubBoardService.CreateInitialBoard() .Returns(new Tuple <List <PointModel>, List <List <PointModel> > >(stubPoints, null)); var mockBoardModel = Substitute.For <BoardModel>(stubBoardService); var stubEventSubscriber = new MockEventSubscriber(); mockBoardModel.NewPieceAdded += stubEventSubscriber.Handle; mockBoardModel.SelectionChanged += stubEventSubscriber.Handle; mockBoardModel.PieceMoved += stubEventSubscriber.Handle; var stubPlayer = Substitute.For <PlayerModel>(1, Colors.Yellow); var boardController = new BoardController(mockBoardModel); boardController.AddNewPiece(stubPoints[1], stubPlayer); boardController.ChangeSelection(stubPoints[1], stubPlayer, true); // Act boardController.MoveSelectedPiece(stubPoints[2]); // Assert var expectedPoint = mockBoardModel.Points.Where(p => p.Bounds.Contains(stubPoints[2].Bounds)).First(); Assert.AreEqual(stubPoints[2].Piece, expectedPoint.Piece); }
private bool research(int testX, int testY, BoardController controller, string color) { GameObject piece=controller.getPiece(testX+1, testY); if (piece!=null&&piece.GetComponent<GamePiece>().canHoldRequests) if (check (testX+1, testY, color)) return true; piece=controller.getPiece(testX-1, testY); if (piece!=null&&piece.GetComponent<GamePiece>().canHoldRequests) if (check (testX-1, testY, color)) return true; piece=controller.getPiece(testX, testY+1); if (piece!=null&&piece.GetComponent<GamePiece>().canHoldRequests) if (check (testX, testY+1, color)) return true; piece=controller.getPiece(testX, testY-1); if (piece!=null&&piece.GetComponent<GamePiece>().canHoldRequests) if (check (testX, testY-1, color)) return true; piece=controller.getPiece(testX+1, testY+1); if (piece!=null&&(piece.GetComponent<GamePiece>().transportsRequestsDiagonallym()||controller.getPiece(testX, testY).GetComponent<GamePiece>().transportsRequestsDiagonallym())) if (check (testX+1, testY+1, color)) return true; piece=controller.getPiece(testX+1, testY-1); if (piece!=null&&(piece.GetComponent<GamePiece>().transportsRequestsDiagonallym()||controller.getPiece(testX, testY).GetComponent<GamePiece>().transportsRequestsDiagonallym())) if (check (testX+1, testY-1, color)) return true; piece=controller.getPiece(testX-1, testY+1); if (piece!=null&&(piece.GetComponent<GamePiece>().transportsRequestsDiagonallym()||controller.getPiece(testX, testY).GetComponent<GamePiece>().transportsRequestsDiagonallym())) if (check (testX-1, testY+1, color)) return true; piece=controller.getPiece(testX-1, testY-1); if (piece!=null&&(piece.GetComponent<GamePiece>().transportsRequestsDiagonallym()||controller.getPiece(testX, testY).GetComponent<GamePiece>().transportsRequestsDiagonallym())) if (check (testX-1, testY-1, color)) return true; for (int i=0; i<pointsChecked.Count; i++) { if (((Vector2)pointsChecked[i]).x==testX&&((Vector2)pointsChecked[i]).y==testY) { pointsChecked.RemoveAt(i); i--; } } return false; }
public static void FindHints() { instance.hints.Clear(); for (int j = 0; j < BoardController.height; ++j) { for (int i = 0; i < BoardController.width; ++i) { BaseGem gem = BoardController.GetGem(i, j); // Swap Right BaseGem otherGem = BoardController.GetGem(i + 1, j); if (otherGem && otherGem.type != gem.type) { HintInfo hintInfo = instance.GetHint(gem, otherGem); if (hintInfo != null && !instance.hints.Contains(hintInfo)) { instance.hints.Add(hintInfo); } } // Swap Up otherGem = BoardController.GetGem(i, j + 1); if (otherGem && otherGem.type != gem.type) { HintInfo hintInfo = instance.GetHint(gem, otherGem); if (hintInfo != null && !instance.hints.Contains(hintInfo)) { instance.hints.Add(hintInfo); } } } } }
void Start() { //Instatiate Board manager and the Board MVC as a component boardManager = new BoardManager(); boardController = new BoardController(); boardManager.SetBoardController(boardController); boardManager.InstantiateBoardMVC(); BoardLayout(); //Instatiate Program manager and the Program MVC as a component programManager = new ProgramManager(); programController = new ProgramController(); programManager.SetProgramController(programController); programManager.SetBoardController(boardManager.boardController); programManager.InstantiateProgramModeMVC(); //Display initial board setup boardDisplay.color = new Color(1, 1, 1, 1); programModeInstructions.color = new Color(1, 1, 1, 1); boardDisplay.text = boardManager.boardView.UpdateBoardDisplay(); //Win condition UI and instructions levelWinCondition.text = WinConditionStatus(); }
/// <summary> /// Generates a new board. /// </summary> public void GenerateBoard() { // Base case: no tile prefab. if (tilePrefab == null) { Debug.LogError ("Missing reference to tile prefab."); return; } // Delete the old board object. if (board != null) { GameObject.DestroyImmediate (board.gameObject); } // Construct a board definition. BoardDefinition generatedBoardDefinition = new BoardDefinition (20, 20); // Construct the board GameObject. GameObject boardObject = new GameObject ("Generated Board"); boardObject.transform.SetParent (transform); board = boardObject.AddComponent<BoardController> (); // Load the tiles onto the board. board.LoadBoard (generatedBoardDefinition, tilePrefab); }
public void Update() { if (!_CollapsingCollumns) { return; } for (int x = 0; x < _BoardSize._Column; ++x) { for (int y = 0; y < _BoardSize._Row; ++y) { if (_LinkerObjects[x, y] && _LinkerObjects[x, y].IsFalling()) { return; } } } _CollapsingCollumns = false; int shuffleCount = 0; while (shuffleCount < _MaxShuffles && !BoardController.HasAnyThreeOrMoreChains(_BoardSize, _LinkerObjects)) { ++shuffleCount; if (shuffleCount < _MaxShuffles) { BoardController.ShuffleBoard(_BoardSize, ref _BoardTiles, ref _LinkerObjects); } else { PostGameResults._ShuffleFailure = true; Publisher.Instance.NotifyAll(ESubjectTypes.LevelEnd); } } }
static void TasksMenu(UserController userController, BoardController boardController) { while (true) { Console.Clear(); int i = 0; foreach (var task in boardController.Tasks) { Console.WriteLine($"[{++i}] {task}"); } Console.WriteLine("[0] Назад."); if (Int32.TryParse(Console.ReadLine(), out int input)) { if (input == 0) { return; } if (input <= i) { TaskMenu(userController, boardController, boardController.Tasks[--input]); } } } }
void Start() { // Store current window size for restoration after fullscreen // will remain at default (640x480) if already fullscreen if (!Screen.fullScreen) { width = Screen.width; height = Screen.height; } // Set static prefab array references hexprefabs = hexprefabcontainer; hexelprefabs = hexelprefabcontainer; sounds = soundcontainer; numbers = numbercontainer; hexelpreviews = hexelpreviewcontainer; // Create controllers gamecontroller = (GameController)gameObject.AddComponent <GameController>(); boardcontroller = (BoardController)gameObject.AddComponent <BoardController>(); rowcontroller = (RowController)gameObject.AddComponent <RowController>(); savecontroller = (SaveController)gameObject.AddComponent <SaveController>(); soundcontroller = (SoundController)gameObject.AddComponent <SoundController>(); }
void Awake() { Instance = this; for (int laneIndex = 0; laneIndex < 8; laneIndex++) { var lane = new BoardLane(); Lanes.Add(lane); float laneRotation = laneIndex / 2 * 90; for (int position = 0; position < LaneLength; position++) { if (laneIndex % 2 == 0) { Vector2 newPosition = (InitialStraight + OffsetStraight * position).Rotate(laneRotation); lane.Add(newPosition); } else { Vector2 newPosition = (InitialDiagonal + OffsetDiagonal * position).Rotate(laneRotation); lane.Add(newPosition); } } } }
public override IEnumerator Execute(BoardController boardController, List <Point> board) { if (this.unit == null) { yield return(null); } unit.Board = board; //MOVE, highlight tiles, move List <Point> validPositions = GetMovementValidPositions(); boardController?.SwitchTilesFromActiveBoards(new HashSet <Point>(validPositions), TileStates.HIGHLIGHT); yield return(new WaitForSeconds(0.5f)); Move(); boardController?.ClearAllActiveBoardsDecorations(); yield return(new WaitForSeconds(1f)); //ATTACK Attack(); yield return(new WaitForSeconds(1f)); }
void Start() { cc = GetComponent<CapsuleCollider>(); board = GameObject.Find("Board").GetComponent<BoardController>(); inAttackEffect = new List<GameObject>(); attackCollider = transform.Find("AttackArea").GetComponent<BoxCollider>(); attackDistance = attackCollider.size.z * .75f; anim = transform.GetComponentInChildren<Animator>(); }
private PieceController getPiece(BoardController board, Model.Action act) { return board.getTile(act.piece.position).myPiece; }
private Model.State getState(BoardController board, bool player1Turn) { return new Model.State(board.p1, board.p2, player1Turn); }
/// <summary> /// /// </summary> /// <param name="roadCharacter"></param> private void HandleEndSquareCourse( BoardController boardController) { int nextRow = mRow; int nextColumn = mColumn; CardinalPoint roadDirection = mRoadDirection; CardinalPoint oppositeCardinalPoint = (CardinalPoint)Enum.ToObject(typeof(CardinalPoint), (((int)(mRoadDirection) + 2) % 4)); CardinalPoint targetDirection = mOriginRoadDirection; switch (roadDirection) { case CardinalPoint.N: nextRow += 1; break; case CardinalPoint.S: nextRow -= 1; break; case CardinalPoint.E: nextColumn += 1; break; case CardinalPoint.W: nextColumn -= 1; break; } if ((nextRow < 0) || (nextRow > (boardController.Size - 1)) || (nextColumn > (boardController.Size - 1)) || nextColumn < 0) { if ((nextRow < 0 && targetDirection == CardinalPoint.S) || (nextRow > (boardController.Size - 1) && targetDirection == CardinalPoint.N) || (nextColumn > (boardController.Size - 1) && targetDirection == CardinalPoint.E) || nextColumn < 0 && targetDirection == CardinalPoint.W) { mSpeed = 0f; mArrivedAtDestination = true; } else { mRoadDirection = oppositeCardinalPoint; } } else { mReachHalfSquare = false; mSquareLocation = 0; if (!boardController.HasSquareExit(nextRow, nextColumn, oppositeCardinalPoint)) { mRoadDirection = oppositeCardinalPoint; } else { mRow = nextRow; mColumn = nextColumn; } } }
/// <summary> /// Perform any transitioning /// </summary> /// <param name="dt"></param> /// <param name="boardController"></param> private void UpdateBehavior(float dt, BoardController boardController) { Parent.AnimController.PlayAnimation(RoadAnimationNames.kIdle, MirrorMode.None); if (!mArrivedAtDestination) { if (mSquareLocation > 0.5f * Square.kPixelSize && !(mReachHalfSquare)) { // Debug.WriteLine("Handle Half Square " + " Position " + roadCharacter.Position + " Row " + roadCharacter.Row + " Column " + roadCharacter.Column + "Direction " + roadCharacter.RoadDirection); HandleMiddleSquareCourse(boardController); mReachHalfSquare = true; } else if (mSquareLocation > Square.kPixelSize) { // Debug.WriteLine("Handle End Square " + " Position " + roadCharacter.Position + " Row " + roadCharacter.Row + " Column " + roadCharacter.Column + "Direction " + roadCharacter.RoadDirection); HandleEndSquareCourse(boardController); } } }
void Update() { if (controller==null) controller=GameObject.Find("GameController").GetComponent<BoardController>(); if (controller.selected!=gameObject||controller.getMovesLeft()==0||controller.getPlayerTurn()!=getPlayer()) mouseExited(); if (gameObject.GetComponent<GamePiece>().getVirusSymbol()!=null) mouseExited(); }
/// <summary> /// /// </summary> /// <param name="character"></param> private void HandleMiddleSquareCourse( BoardController boardController) { int row = mRow; int column = mColumn; bool[] squareExitStatus = new bool[4]; bool noExit = true; int randomCardinalPoint = mRandom.Next(0, 4) - 1; CardinalPoint targetDirection = mOriginRoadDirection; CardinalPoint currentDirection = mRoadDirection; // Cardinal Point{ N, W, S, E } for (int cardinalPoint = 0; cardinalPoint < 4; cardinalPoint++) { squareExitStatus[cardinalPoint] = boardController.HasSquareExit(row, column, (CardinalPoint)Enum.ToObject(typeof(CardinalPoint), cardinalPoint)); } if (squareExitStatus[(int)targetDirection] && ((int)currentDirection != ((int)targetDirection + 2) % 4)) { mRoadDirection = targetDirection; noExit = false; } else if (squareExitStatus[(int)mRoadDirection] && ((int)currentDirection != ((int)targetDirection + 2) % 4)) { noExit = false; } else { for (int cardinalPoint = 0; cardinalPoint < 4; cardinalPoint++) { randomCardinalPoint += 1; if (randomCardinalPoint == 4) { randomCardinalPoint = 0; } if (randomCardinalPoint != (((int)(currentDirection) + 2) % 4) && (randomCardinalPoint != ((int)targetDirection + 2) % 4)) { if (squareExitStatus[randomCardinalPoint]) { mRoadDirection = (CardinalPoint)Enum.ToObject(typeof(CardinalPoint), randomCardinalPoint); noExit = false; cardinalPoint = 3; } } } } if (noExit) { if (squareExitStatus[(((int)targetDirection + 2) % 4)]) { mRoadDirection = (CardinalPoint)Enum.ToObject(typeof(CardinalPoint), (((int)(targetDirection) + 2) % 4)); } else { mRoadDirection = (CardinalPoint)Enum.ToObject(typeof(CardinalPoint), (((int)(currentDirection) + 2) % 4)); } } }
// Use this for initialization void Start() { time = Time.time; Instance = this; pickSkill.onClick.AddListener(()=> PickSkillFunc(PlayerController.Instance.boneCount)); }
// Use this for initialization void Start() { BoardController = FindObjectOfType<BoardController>(); }
public void Initialize(int size) { Controller = new BoardController(size); }
public void Activity(float dt, BoardController boardController) { if (mTime >= 1.0f) { mTime = 0; mState = (DebugState) (((int) mState + 1) % 7); switch (mState) { case DebugState.Idle: Parent.AnimController.PlayAnimation(RoadAnimationNames.kIdle, MirrorMode.None); break; case DebugState.Walk_Left: Parent.AnimController.PlayAnimation(RoadAnimationNames.kWalkRight, MirrorMode.None); break; case DebugState.Walk_Right: Parent.AnimController.PlayAnimation(RoadAnimationNames.kWalkRight, MirrorMode.Horizontal); break; case DebugState.Run_Left: Parent.AnimController.PlayAnimation(RoadAnimationNames.kRunRight, MirrorMode.None); break; case DebugState.Run_Right: Parent.AnimController.PlayAnimation(RoadAnimationNames.kRunRight, MirrorMode.Horizontal); break; case DebugState.Run_Forward: Parent.AnimController.PlayAnimation(RoadAnimationNames.kRunForward, MirrorMode.None); break; case DebugState.Run_Back: Parent.AnimController.PlayAnimation(RoadAnimationNames.kRunBack, MirrorMode.None); break; } } else { mTime += dt; } }
// Use this for initialization void Awake () { board = GetComponent<Board> (); detector = GetComponent<MatchDetector> (); boardController = GetComponent<BoardController> (); }
public void Start() { panelControllerFather = GetComponentInParent<BoardController> (); //textUI.text = this.type; RefreshDisplayText(); }
public void Activity(float dt, BoardController boardController) { UpdateBehavior(dt, boardController); StepPosition(dt); }