void Start() { GameBoardScript gameboard = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameBoardScript>(); linesText.text = "Lines used: " + gameboard.linesString; timeText.text = "Time Elapsed: " + gameboard.elapsedString; }
public void OnMouseDown() { if (!gameboard) { gameboard = FindObjectOfType <GameBoardScript>(); } gameboard.resetSlots(); }
[SerializeField] UnityEvent OnMinoStuck;//ミノを動かせなくなったとき実行する関数を格納する変数 private void Awake() { if (OnMinoStuck == null) { OnMinoStuck = new UnityEvent(); //イベント・インスタンスの作成 } gameBoardS = gameBoard.GetComponent <GameBoardScript>(); }
void Start() { scoreTextStatic = scoreText; score = 0; snake = Instantiate(snakePrefab); snakeScript = snake.GetComponent <SnakeManager>(); board = Instantiate(boardPrefab); boardScript = board.GetComponent <GameBoardScript>(); }
public void InitializeMe(string name, GameObject tile, GameBoardScript gameBoard, EnemySpawnerScript spawner) { myPool = spawner; myOffSetY = Random.Range(-0.4f, 0.4f); myOffSetX = Random.Range(-0.4f, 0.4f); board = gameBoard; health = 15; moveSpeed = 1; curTile = tile; curDirection = curTile.GetComponent <TileScript>().GetMyDirection(); }
void Start() { board = GameObject.Find("Game Board").GetComponent <GameBoardScript>(); startingTile = board.GetPathStart(); for (int i = 0; i < bBugPool.Length; i++) { bBugPool[i] = Instantiate(bBugPrefab, transform); bBugPool[i].GetComponent <BaseEnemyScript>().InitializeMe("Basic Bug", startingTile, board, this); bBugPool[i].transform.name = "Basic Bug"; } }
// Start is called before the first frame update void Start() { gameBoard = GameObject.Find("GameBoard"); gameBoardScpt = gameBoard.GetComponent <GameBoardScript>(); Debug.Log("-->> " + gameBoardScpt.cardStacked); //energyText = GameObject.Find("InspectorEnergy").GetComponent<Text>(); cardPrice = card.price; cardSavings = (card.savesInMil * 1000000f); energyCost = card.energy; cardDescription = card.description.Replace("<newline>", "\n"); Debug.Log("67 energycost" + energyCost); //this.gameObject.image.color = new Color32(255,255,255,0); nameText.text = card.cardName; descriptionText.text = cardDescription; //descriptionText.text = descriptionText.text.Replace("<tab>", "\t"); priceText.text = cardPrice.ToString("c"); energyText.text = energyCost + " Mwh"; cardType = card.cardType; cardSecret = card.secret.Replace("<newline>", "\n"); gameMaster = GameObject.Find("GameMaster"); gameScript = gameMaster.GetComponent <GameScript>(); //secretText.text = card.secret; switch (cardType) { case 1: // if cardType == 1 GetComponent <Image>().color = Color.blue; Text[] cardText = GetComponentsInChildren <Text> (); foreach (Text text in cardText) { text.color = Color.white; } Debug.Log("Card is blue!"); break; case 2: // if cardType == 2 GetComponent <Image>().color = new Color(255, 0, 181, 1); Debug.Log("Card is Pink!"); break; case 3: // if cardType == 3 GetComponent <Image>().color = new Color(255, 128, 0, 1); Debug.Log("Card is orange!"); break; case 0: // if cardType != (1,2,3) GetComponent <Image>().color = Color.green; Debug.Log("Card is Green!"); break; } }
public void OnEndDrag(PointerEventData eventData) { //Debug.Log("End Drag"); GameObject gameBoardObj = GameObject.Find("GameBoard"); GameBoardScript gameBoardScpt = gameBoardObj.GetComponent <GameBoardScript>(); RectTransform gameBoard = gameBoardObj.GetComponent <RectTransform>(); //Debug.Log("GameBoard Position:: " + gameBoard.transform.position.x + ", " + gameBoard.transform.position.y); //Debug.Log("LocalPosition:: " + gameBoard.transform.localPosition.x + ", " + gameBoard.transform.localPosition.y); if (RectTransformUtility.RectangleContainsScreenPoint(gameBoard.GetComponent <RectTransform>(), Input.mousePosition, Camera.main)) //if (RectTransformUtility.RectangleContainsScreenPoint(gameBoard, Input.mousePosition)) { Debug.Log("Dropped on board."); Debug.Log("GameBoard Position:: " + gameBoard.transform.position.x + ", " + gameBoard.transform.position.y); Debug.Log("LocalPosition:: " + gameBoard.transform.localPosition.x + ", " + gameBoard.transform.localPosition.y); //if(GetComponent<CardDisplay>().CheckEnergy() && GetComponent<CardDisplay>().CheckMoney()){ if (GetComponent <CardDisplay>().CanPlay()) { Debug.Log("Can Play!"); // Debug.Log(playerMoney + " - " + cardPrice + " = " + (playerMoney - cardPrice)); // Debug.Log(playerMoney + " - " + cardPrice + " = " + (playerMoney - cardPrice)); //playerMoney -= cardPrice; //GetComponent<CardDisplay>().SubtractResources(); GetComponent <CardDisplay>().UpdateResources(); Debug.Log(this.transform.position.x + ", " + this.transform.position.y + " |VS| loc: " + this.transform.localPosition.x + ", " + this.transform.localPosition.y); GetComponent <CardDisplay>().PlayCard(); GameObject.Find("GameUI").GetComponent <GameUI>().UpdateBank(); //this.enabled = false; GetComponent <RectTransform>().localScale = new Vector3(1f, 1f, 0f); //Destroy(this); Debug.Log("THIS SHOULD NEVER PRINT. Enabled = false"); } else { Debug.Log("Cannot play..."); GameObject.Find("GameMaster").GetComponent <GameScript>().ShowErrorMessage("Not Enough Resources!", 1.0f); this.transform.position = startingPos; } } else { // this.transform.localPosition = startingPos; this.transform.position = startingPos; } }
IEnumerator BoardStack(GameObject source, GameObject boardArea, float overTime) { // gameBoardScpt = GameObject.Find("GameBoard").GetComponent<GameBoardScript>(); // Debug.Log(gameBoardScpt.cardStacked + " attempting card stacked"); // while(gameBoardScpt.cardStacked == false){ //Check if other card is stacking // yield return 1f; // Debug.Log(gameBoardScpt.cardStacked + " <- ll"); // Debug.Log("waiting"); // } // gameBoardScpt.cardStacked = false; Vector3 sourcePos = source.GetComponent <RectTransform>().position; gameBoardScpt = gameBoard.GetComponent <GameBoardScript>(); yield return(new WaitForSeconds(2)); float startTime = Time.time; Vector3 destLocation = new Vector3(gameBoardScpt.lastPlayed.GetComponent <RectTransform>().localPosition.x + (gameBoardScpt.lastPlayed.GetComponent <RectTransform>().rect.width), // + (source.GetComponent<RectTransform>().rect.width / 2), gameBoardScpt.lastPlayed.GetComponent <RectTransform>().localPosition.y, // - (gameBoardScpt.lastPlayed.GetComponent<RectTransform>().rect.width), gameBoardScpt.lastPlayed.GetComponent <RectTransform>().localPosition.z); while (Time.time < startTime + overTime) { //Debug.Log(source.GetComponent<RectTransform>().position.x + ", " + source.GetComponent<RectTransform>().position.y + ") going to, (" + gameBoardScpt.lastPlayed.GetComponent<RectTransform>().position.x + ", " + gameBoardScpt.lastPlayed.GetComponent<RectTransform>().position.y); //Debug.Log("Width:SizeDelta, " + gameBoardScpt.lastPlayed.GetComponent<RectTransform>().rect.width + " :: " + gameBoardScpt.lastPlayed.GetComponent<RectTransform>().sizeDelta.x); source.transform.localPosition = Vector3.Lerp(source.GetComponent <RectTransform>().localPosition, destLocation, // boardArea.transform.position.y, // boardArea.transform.position.z), (Time.time - startTime) / overTime); Debug.Log("DestLoc: (" + destLocation.x + ", " + destLocation.y + ", " + destLocation.z + ")"); yield return(null); } //source.transform.position = boardArea.transform.position; //source.transform.position = gameBoardScpt.lastPlayed.transform.position; source.GetComponent <CardHover>().DestroyScript(); gameBoardScpt.lastPlayed = gameBoardScpt.currentCard; gameBoardScpt.currentCard = null; gameBoardScpt.cardStacked = true; }
public void PlayCard() { gameBoardScpt = GameObject.Find("GameBoard").GetComponent <GameBoardScript>(); if (gameBoardScpt.cardStacked) { gameBoardScpt.cardStacked = false; ResizeThisCard(3.0f); //MoveOverTime(gameObject, gameBoardScpt.lastPlayed, 3.0f); this.transform.SetParent(gameBoard.transform, false); StackOnBoard(gameObject, gameBoardScpt.lastPlayed, 1.0f); gameScript.ReduceCo2e(card.co2e); gameScript.AddCardToRoundDeck(this.gameObject); //Debug.Log("Reduced by " + card.co2e); } else { Debug.Log("Problem!Problem!"); this.transform.position = GetComponent <CardHover>().startingPos; } }
void Awake() { gameBoard = GameObject.Find("Game Board").GetComponent <GameBoardScript>(); }
private LevelStartStopHandler() { gameboard = FindObjectOfType <GameBoardScript>(); }
private void Awake() { gameMgr = GameObject.Find("EmptyObject for Board").GetComponent <GameBoardScript>(); }