private void Awake() { cachedTransform = transform; cachedTransform.position = Vector3.zero; boardData = BoardData.Create(boardColumns, boardRows); instance = this; }
void OnLevelWasLoaded(int level) { if (level == 2) { board = GameObject.Find("Board").GetComponent <BoardBehaviour>(); header = GameObject.Find("header").GetComponent <Text>(); readyPanel = GameObject.Find("ReadyPanel"); rollInitPanel = GameObject.Find("RollInitPanel"); player1_panel = GameObject.Find("Player1_Panel"); player2_panel = GameObject.Find("Player2_Panel"); readyPanel.SetActive(false); player1_panel.SetActive(false); player2_panel.SetActive(false); var slotsOnField = GameObject.FindGameObjectsWithTag("Slot"); for (int i = 0; i < board.slots.Length; i++) { board.slots[i] = slotsOnField[i]; } player1 = Instantiate(player_1_model, new Vector3(board.slots[0].transform.position.x + player1_offset, 0, board.slots[0].transform.position.z + player1_offset), Quaternion.identity); player2 = Instantiate(player_2_model, new Vector3(board.slots[0].transform.position.x + player2_offset, 0, board.slots[0].transform.position.z + player2_offset), Quaternion.identity); player1Pos = 0; player2Pos = 0; endTurn = GameObject.Find("EndTurn"); endTurn.SetActive(false); chanceCardPanel = GameObject.Find("ChanceCardPanel"); chanceCardPanel.SetActive(false); gameOverPanel = GameObject.Find("OverPanel"); gameOverPanel.SetActive(false); } }
public GridTileBehaviour Init(int x, int y, BoardBehaviour board) { Index = new GridIndex(x, y); this.board = board; return(this); }
// Use this for initialization void Start() { boardBehaviour = BoardManager.GetComponent <BoardBehaviour> (); replayInfo = replayInfoObject.GetComponent <ButtonController> (); gameLoaded = false; mainDirectory = Directory.GetCurrentDirectory(); Debug.Log("Current Directory = " + mainDirectory); //Check if the logs directory exists if (!Directory.Exists(mainDirectory + @"\Logs")) { Directory.CreateDirectory(mainDirectory + @"\Logs"); } logPath = mainDirectory + @"\Logs"; //Check if the index file exists, update index number if it does if (!File.Exists(logPath + @"\Index.txt")) { File.Create(logPath + @"\Index.txt").Close(); nextFreeIndex = 0; } else { streamReader = new StreamReader(logPath + @"\Index.txt"); while (!streamReader.EndOfStream) { streamReader.ReadLine(); nextFreeIndex++; } streamReader.Close(); Debug.Log("Index loaded"); } }
private void OnMouseDown() { if (BoardBehaviour.IsCurrentPlayerAction()) { NetworkController.Instance.PlayerEndTurn(); } }
public TilesManager(BoardBehaviour board, int columns, int rows) { this.columns = columns; this.rows = rows; this.board = board; tiles = new GridTileBehaviour[columns, rows]; SetupTiles(); }
public override void OnInitialize(BoardBehaviour board) { foreach (BumperBehaviour bumper in board.GetBumpers()) { bumper.raiseBehaviour.onLower.AddListener((RaiseBehaviour b) => { bumper.Kill(); }); } }
// Update is called once per frame public override void OnInitialize(BoardBehaviour board) { foreach (BumperBehaviour bumper in board.GetBumpers()) { bumper.raiseBehaviour.onRaise.AddListener((RaiseBehaviour b) => { bumper.isLockedByRule = true; }); } }
public void Start() { m_time = m_timePerTurn; m_hand = GameObject.FindObjectOfType<HandBehaviour>(); m_board = (BoardBehaviour)GameObject.FindObjectOfType<BoardBehaviour>(); InvokeRepeating("CountDown", 1, 1); InvokeRepeating("SetTimeSandFloat", 0, 1); }
// Use this for initialization void Start() { tintColour = lightCyan; opacity = 0.5f; boardBehaviour = boardManager.GetComponent <BoardBehaviour> (); gameManager = gameController.GetComponent <GameManager> (); player1 = gameManager.GetPlayerControl(1); player2 = gameManager.GetPlayerControl(2); }
private void OnMouseDown() { if (BoardBehaviour.GetUIState() == UIState.TARGETING) { if (state == CardState.SLOT) { BoardBehaviour.SelectTarget(gameObject); BoardBehaviour.SetUIState(UIState.ACTION); } } }
// Use this for initialization void Start() { textMesh.text = ""; boardBehaviour = boardManager.GetComponent <BoardBehaviour> (); Color tempColour = textMesh.color; tempColour.a = 0; textMesh.color = tempColour; enabled = false; }
private void ClearGemAt(GridIndex index) { var gem = GetGem(index); if (gem != null) { allGems[index.GridX, index.GridY] = null; gem.OnMoveComplete -= HandleGemMoveComplete; BoardBehaviour.DestroyGem(gem); } }
public int y; //The y position of the textbox // Use this for initialization void Start() { contents = 0; boardBehaviour = boardControl.GetComponent <BoardBehaviour> (); gameManager = gameController.GetComponent <GameManager> (); player1 = gameManager.GetPlayerControl(1); player2 = gameManager.GetPlayerControl(2); rand = new System.Random(); }
private void OnMouseDown() { if (BoardBehaviour.GetUIState() != UIState.TARGETING && BoardBehaviour.GetUIState() != UIState.SLOT_TARGETING && BoardBehaviour.IsCurrentPlayerAction()) { NetworkController.Instance.PlayerAttackWithSlot(BoardBehaviour.LocalPlayerName,SlotId,SlotId); } if (BoardBehaviour.GetUIState() == UIState.SLOT_TARGETING) { NetworkController.Instance.SelectSlotEmit(BoardBehaviour.LocalPlayerName,Pob.PlayerName,SlotId); BoardBehaviour.SetUIState(UIState.ACTION); } }
public GridManager(BoardBehaviour board, int columns, int rows, float gemFallSpeed) { this.columns = columns; this.rows = rows; this.gemFallSpeed = gemFallSpeed; this.board = board; allGems = new GemBehaviour[columns, rows]; matchingHelper = new GemMatchingHelper(this); FillBoard(); }
//private List<CharacterBehaviour> team; // Use this for initialization void Awake() { go = transform.parent.parent.gameObject; board = go.GetComponent <BoardBehaviour> (); maxMembers = board.membersPerTeam; health = maxMembers * 1000f; maxHealth = health; barra = transform.FindChild("Bar"); barraSize = barra.localScale; targetSize = barraSize; targetSize.x = 0.0f; barra.renderer.material.color = Color.green; }
// Constructor public MonteCarlo2(GameObject boardManager, int playerNumber) { this.boardManager = boardManager; this.boardBehaviour = boardManager.GetComponent <BoardBehaviour> (); this.playerNumber = playerNumber; if (playerNumber == 1) { enemyNumber = 2; } else { enemyNumber = 1; } }
// Use this for initialization void Start() { boardBehaviour = boardManager.GetComponent <BoardBehaviour> (); rand = new System.Random(); defaultScale = this.transform.localScale; if (player == 1) { this.transform.position = Camera.main.ViewportToWorldPoint(new Vector3(0.05F, 1F, 8.9F)); } else { this.transform.position = Camera.main.ViewportToWorldPoint(new Vector3(0.3F, 1F, 8.9F)); } }
private void MoveTo(CellData desiredCell, CellData currentPosition) { if (desiredCell.IsEmpty()) { Vector3 desiredCellPosition = BoardBehaviour.Get().GetWorldPositionOfCell(desiredCell); Vector3 destination = new Vector3(desiredCellPosition.x, cachedTransform.position.y, desiredCellPosition.z); currentPosition.SetEmpty(true); desiredCell.SetEmpty(false); GameController.Get().StartCoroutine(this.MovingToCell(destination)); } else { Move(soldierGoal, movementRange); } }
void Start() { // Tem que estart aqui no Start board = transform.parent.parent.GetComponent <BoardBehaviour>(); lifebars = board.transform.Find("Lifebars"); Color color; if (TeamNumber == 0) { color = new Color(255, 0, 0); } else { color = new Color(0, 0, 255); } transform.FindChild("Base").renderer.material.color = color; LoadParametersBalance(); }
private void Play(BoardBehaviour scriptBoard) { bool ok = false; GameObject[,] Squares = scriptBoard.m_cubes; GameObject FocusSquare; //Debug.Log("Opponent start Playing"); if (scriptBoard.m_turnType [scriptBoard.m_turnNewNumber] == 0) { do { int x = (int)Random.Range (0f, 5f); //Debug.Log(x); int y = (int)Random.Range (0f, 4f); //Debug.Log(y); GameObject place = Squares [x, y]; SquareBehaviour Script = place.GetComponent<SquareBehaviour> (); if (!Script.m_isOccuped) { FocusSquare = place; GameObject PlayedCard = m_opponentDeckUnit [0]; m_opponentDeckUnit.Remove (PlayedCard); scriptBoard.PutTokken (FocusSquare, PlayedCard); ok = true; return; } } while (!ok); //Debug.Log("Impossible to Play: No Empty Square"); } else { int x = (int)Random.Range (0f, 5f); //Debug.Log(x); int y = (int)Random.Range (0f, 4f); //Debug.Log(y); GameObject place = Squares [x, y]; scriptBoard.PutLand(place,m_opponentDeckLand[0]); return; } }
private void OnMouseOver() { if (!mouseHovering && !isExpanding && BoardBehaviour.GetUIState() != UIState.BATTLING && canMouseHover) { gameObject.transform.position = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, -2f); mouseHovering = true; } if (Input.GetAxis("Mouse ScrollWheel") > 0f) { gameObject.transform.DOMove(new Vector3(0f, 0f, -2f), GameConfig.F("CARD_EXPAND_TIME")).SetEase(Ease.OutCubic); gameObject.transform.DOScale(GameConfig.F("CARD_EXPAND_SCALE"), GameConfig.F("CARD_EXPAND_TIME")).SetEase(Ease.OutCubic); isExpanding = true; } if (Input.GetAxis("Mouse ScrollWheel") < 0f) { gameObject.transform.DOMove(originPos, GameConfig.F("CARD_EXPAND_TIME")).SetEase(Ease.OutCubic); gameObject.transform.DOScale(1f, GameConfig.F("CARD_EXPAND_TIME")).SetEase(Ease.OutCubic); isExpanding = false; } }
public override void OnEndDrag() { DisableAllGlow(); // find cardslot when end drag GameObject endSlot = null; RaycastHit[] hits = Physics.RaycastAll(origin: new Vector3(transform.position.x, transform.position.y, -10), direction: new Vector3(0, 0, 1), maxDistance: 30f); foreach (RaycastHit h in hits) { if (h.transform.tag == "CardSlot") { endSlot = h.transform.gameObject; } } CardObjectBehaviour cob = gameObject.GetComponent <CardObjectBehaviour>(); if (endSlot != null && BoardBehaviour.IsCurrentPlayerAction()) { //Dragged into a cardslot CardSlotBehaviour csb = endSlot.GetComponent <CardSlotBehaviour>(); NetworkController.Instance.PlayerPlayCardToSlot(cob.Owner.PlayerName, cob.Guid, csb.SlotId); // Move card to neutral position and play effects Vector3 spellEffectPos = BoardBehaviour.NeutralBattlePoint.transform.position; gameObject.transform.DOMove(new Vector3(spellEffectPos.x, spellEffectPos.y, -3f), GameConfig.F("SPELL_CARD_FLY_TIME")); gameObject.transform.DOScale(GameConfig.F("SPELL_CARD_SCALE"), GameConfig.F("SPELL_CARD_FLY_TIME")); // - Add effect to the card cob.AddEffectParticle(); } else { // Dragged into somewhere else transform.DOMove(cob.OriginPos, 0.5f).SetEase(Ease.OutCubic); } }
// Use this for initialization void Start() { titleManager = title.GetComponent <TitleManager> (); gameManager = gameController.GetComponent <GameManager> (); fileManager = GameLogger.GetComponent <FileManager> (); boardBehaviour = boardManager.GetComponent <BoardBehaviour> (); endGameInfoController = endgameInfo.GetComponent <EndgameInfoController> (); cameraController = camera.GetComponent <MoveCamera> (); menuState = MenuState.main; menuOptions1 = MenuOptions1.start; menuOptions2 = MenuOptions2.pvp; menuOptions3 = MenuOptions3.load1; aiChoice1 = AiChoiceOptions.GreedyAI; aiChoice2 = AiChoiceOptions.GreedyAI; updateNeeded = true; button1 = button1Object.GetComponent <ButtonController> (); button2 = button2Object.GetComponent <ButtonController> (); button3 = button3Object.GetComponent <ButtonController> (); button4 = button4Object.GetComponent <ButtonController> (); button5 = button5Object.GetComponent <ButtonController> (); pageViewer = pageIndicator.GetComponent <ButtonController> (); version = versionInfo.GetComponent <ButtonController> (); currentLoadPage = 0; button1.selected = true; titleManager.enabled = true; inMenu = true; camera.transform.position = new Vector3(50F, 504F, 20); camera.transform.rotation = Quaternion.Euler(0, 0, 0); cameraController.rotationMultiplier = 0; }
public GemBehaviour Init(BoardBehaviour board) { this.board = board; return(this); }
public virtual void OnInitialize(BoardBehaviour board) { }
public void Initialize(BoardBehaviour board) { boardAffected = board; OnInitialize(board); }
// Use this for initialization void Start() { otherB = otherBoard.GetComponent <BoardBehaviour>(); settings = transform.GetChild(0).GetComponent <ParticleSystem>().main; }
void Awake() { BoardScript = transform.parent.parent.GetComponent <BoardBehaviour> (); }
private void InstantiateBoard() { board = GetComponent <BoardBehaviour>(); }
// Use this for initialization void Start() { board1 = GameObject.Find("Board1").transform; board2 = GameObject.Find("Board2").transform; anim = GetComponent <Animator>(); bb1 = board1.GetComponent <BoardBehaviour>(); bb2 = board2.GetComponent <BoardBehaviour>(); pf = GetComponent <PlayerFollower>(); playerTags.Add("Bean"); playerTags.Add("Eal"); playerTags.Add("Loin"); playerTags.Add("Sage"); //DTAction a1 = new DTAction(FollowPlayer); //dt = new DecisionTree(a1); if (isServer) { //define decisions DTDecision d1 = new DTDecision(IsABoardActiveFor2Seconds); DTDecision d2 = new DTDecision(MoleIsAlive); DTDecision d3 = new DTDecision(IsABoardActiveFor5Seconds); DTDecision d4 = new DTDecision(AtLeastOneInAreaA); DTDecision d5 = new DTDecision(AtLeastTwoInAreaB); DTDecision d6 = new DTDecision(AtLeastOneInAreaC); DTDecision d7 = new DTDecision(AtLeastTwoInAreaC); DTDecision d8 = new DTDecision(MoleIsAlive); DTDecision d9 = new DTDecision(MoleIsAlive); //define actions DTAction a1 = new DTAction(TpAtActiveBoard); DTAction a2 = new DTAction(LoadRoundAttack); DTAction a3 = new DTAction(LoadFrontAttack); DTAction a4 = new DTAction(FollowClosestPlayer); DTAction a5 = new DTAction(FollowPlayerWithLessLives); DTAction a6 = new DTAction(FollowPlayerWithLessLivesInAreaC); d1.AddLink(true, d2); d1.AddLink(false, d4); d2.AddLink(true, d3); d2.AddLink(false, a1); d3.AddLink(true, a1); d3.AddLink(false, d4); d4.AddLink(true, d5); d4.AddLink(false, d6); d5.AddLink(true, a2); d5.AddLink(false, a3); d6.AddLink(true, d7); d6.AddLink(false, d8); d7.AddLink(true, d9); d7.AddLink(false, a4); d8.AddLink(true, a4); d8.AddLink(false, a5); d9.AddLink(true, a4); d9.AddLink(false, a6); dt = new DecisionTree(d1); StartCoroutine(Patrol()); } }
public void Start() { m_board = GameObject.FindObjectOfType<BoardBehaviour>(); }