void Awake() { if (Application.platform == RuntimePlatform.IPhonePlayer) { Debug.Log("on iphone"); // System.Environment.SetEnvironmentVariable("MONO_REFLECTION_SERIALIZER", "yes"); Debug.Log("didn't error"); } EventControl.NewLevelReset(); QControl.Initialize(); playsLeftText = GameObject.Find("plays left #").GetComponent <TextMesh> (); movesLeftText = GameObject.Find("moves left #").GetComponent <TextMesh> (); dollarsText = GameObject.Find("Dollar count").GetComponent <TextMesh> (); deckText = GameObject.Find("Deck count").GetComponent <TextMesh> (); playButton = GameObject.Find("play end button").GetComponent <ButtonAnimate> (); moveButton = GameObject.Find("move end button").GetComponent <ButtonAnimate> (); endTurnButton = GameObject.Find("end turn button").GetComponent <ButtonAnimate> (); handObj = GameObject.Find("Hand"); playBoardObj = GameObject.Find("Play board"); playerObj = GameObject.FindGameObjectWithTag("Player"); player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player> (); gooeyskin = (GUISkin)Resources.Load("GUISkins/S.GameControlInst.guiskin"); SaveDataControl.Load(); StateSavingControl.Initialize(this, player); if (SaveDataControl.UnlockedCards.Count == 0 | SaveDataControl.UnlockedGods.Count == 0) { SaveDataControl.NewSaveFile(); } MainMenu.UnlockCheck(); }
void Start() { useGUILayout = false; playerObject = GameObject.FindGameObjectWithTag("Player"); playButton = GameObject.Find("play end button").GetComponent <ButtonAnimate> (); displayCardCanvas = GameObject.FindGameObjectWithTag("displaycard").GetComponent <DisplayCardCanvas>(); eventSystem = GameObject.FindGameObjectWithTag("eventsystem").GetComponent <EventSystem>(); }
internal void MoveClick(string direction) { bool canMove = S.GameControlInst.MovesLeft > 0; if (GameControl.MovesArePlays) { canMove = S.GameControlInst.PlaysLeft > 0; } if (canMove) { GridUnit thisGU = gameObject.GetComponent <GridUnit>(); int gridSize = GridControl.GridSize; if ((thisGU.xPosition > gridSize && direction == "right") | (thisGU.xPosition < -gridSize && direction == "left") | (thisGU.yPosition > gridSize && direction == "up") | (thisGU.yPosition < -gridSize && direction == "down")) { Debug.Log("blocked!"); return; } thisGU.GridMove(direction); S.GameControlInst.AddMoves(-1); S.ShopControlInst.GoalCheck("Move X times in one turn"); S.ShopControlInst.GoalCheck("Don't move X turns in a row"); S.ShopControlInst.GoalCheck("Don't deal damage or move X turns in a row"); S.ShopControlInst.GoalCheck("Don't move X turns in a row"); S.GridControlInst.DestroyAllTargetSquares(); if (Tutorial.TutorialLevel != 0) { S.GameControlInst.gameObject.GetComponent <Tutorial>().TutorialTrigger(2); } StateSavingControl.Save(); } else { ButtonAnimate moveButton = GameObject.Find("move end button").GetComponent <ButtonAnimate>(); moveButton.ErrorAnimation(); } }
/// A very long and boring initialize method public void Initialize(bool alreadyDiscarded) { //TODO do i need alreadyDiscarded here? card = gameObject.GetComponent <Card> (); PlayButton = GameObject.Find("play end button").GetComponent <ButtonAnimate>(); meshrenderers = GetComponentsInChildren <MeshRenderer>(); SRenderers = gameObject.GetComponentsInChildren <SpriteRenderer>(); // CardBackSprite = Resources.Load("sprites/cards/real pixel card back") as Sprite; discardPileObj = GameObject.Find("Discard pile"); TextMesh[] textMeshes = gameObject.GetComponentsInChildren <TextMesh>(); foreach (TextMesh text in textMeshes) { if (text.gameObject.name == "name text") { text.fontSize = SmallCardTitleFontSize; text.text = card.DisplayName; } else { text.fontSize = SmallCardRulesFontSize; text.text = card.MiniDisplayText; } if (card.God == ShopControl.Gods.Ekcha | card.God == ShopControl.Gods.Ixchel) { text.color = new Color(1, 1, 1); } } CardText[] cardTexts = gameObject.GetComponentsInChildren <CardText>(); SpriteRenderer[] renders = gameObject.GetComponentsInChildren <SpriteRenderer>(); foreach (SpriteRenderer render in renders) { if (render.gameObject.tag == "cardback") { continue; } else if (render.gameObject.name == "picture") { if (card.IconPath != "") { render.sprite = Resources.Load <Sprite>(card.IconPath); } } else if (render.gameObject.name == "rarity") { switch (card.ThisRarity) { case Card.Rarity.Gold: render.sprite = S.ShopControlGUIInst.Gold; break; case Card.Rarity.Silver: render.sprite = S.ShopControlGUIInst.Silver; break; case Card.Rarity.Bronze: render.sprite = S.ShopControlGUIInst.Bronze; break; case Card.Rarity.Paper: render.sprite = S.ShopControlGUIInst.Paper; break; } } else if (render.gameObject.name == "god icon") { int godnum = ShopControl.AllGods.IndexOf(card.God); render.sprite = S.ShopControlGUIInst.SpriteGodIcons[godnum]; } else if (render.gameObject.name == "shine animation") { ShineAnim = render.gameObject.GetComponent <ShineAnimation>(); } else if (render.gameObject.name == "shine animation 2") { continue; } else if (render.gameObject.name == "glow") { Glow = render.gameObject.GetComponent <SpriteRenderer>(); } else if (render.gameObject.name == "aoe icon" | render.gameObject.name == "range icon") { string resourceLoadTarget = "sprites/targeting icons/"; float baseIconSize = 2.4f; if (render.gameObject.name == "range icon") { if (card.rangeTargetType == GridControl.TargetTypes.none) { continue; } resourceLoadTarget += ("range " + card.rangeTargetType.ToString() + " " + card.minRange.ToString() + "-" + card.maxRange.ToString()); baseIconSize = baseIconSize / (card.maxRange * 2 + 1); } else if (render.gameObject.name == "aoe icon") { if (card.aoeTargetType == GridControl.TargetTypes.none) { continue; } resourceLoadTarget += ("aoe " + card.aoeTargetType.ToString() + " " + card.aoeMinRange.ToString() + "-" + card.aoeMaxRange.ToString()); baseIconSize = baseIconSize / (card.aoeMaxRange * 2 + 1); } render.sprite = Resources.Load <Sprite>(resourceLoadTarget); render.gameObject.transform.localScale = new Vector3(baseIconSize, baseIconSize, 0); } else if (render.gameObject.name != "picture") { int godnum = 3; godnum = ShopControl.AllGods.IndexOf(card.God); render.sprite = S.ShopControlGUIInst.GodSmallCards[godnum]; } } foreach (CardText cardText in cardTexts) { cardText.Initialize(101 - card.HandIndex() * 2); } //Sets up font sizes string[] words = card.CardName.Split(' '); int longestWordLength = words [0].Length; for (int i = 0; i < words.Length; i++) { if (words[i].Length > longestWordLength) { longestWordLength = words[i].Length; } } if (longestWordLength > FontVariableMaxTitleWordLength) { SmallCardTitleFontSize = SmallCardTitleFontSize * FontVariableMaxTitleWordLength / longestWordLength; DisplayTitleFontSize = DisplayTitleFontSize * FontVariableMaxTitleWordLength / longestWordLength; } if (card.DisplayText.Length > FontVariableMaxRulesLength) { // ultimate font size = maxlength - (difference * ratio) DisplayRulesFontSize = DisplayRulesFontSize - ((card.DisplayText.Length - FontVariableMaxRulesLength) / SmallCardFontVariableRulesSizeRatio); } if (card.MiniDisplayText.Length > FontVariableMaxMiniRulesLength) { SmallCardRulesFontSize = SmallCardRulesFontSize - ((card.DisplayText.Length - FontVariableMaxRulesLength) / DisplayFontVariableRulesSizeRatio); } }
/// A very long and boring initialize method public void Initialize(bool alreadyDiscarded) { //TODO do i need alreadyDiscarded here? card = gameObject.GetComponent<Card> (); PlayButton = GameObject.Find("play end button").GetComponent<ButtonAnimate>(); meshrenderers = GetComponentsInChildren<MeshRenderer>(); SRenderers = gameObject.GetComponentsInChildren<SpriteRenderer>(); // CardBackSprite = Resources.Load("sprites/cards/real pixel card back") as Sprite; discardPileObj = GameObject.Find("Discard pile"); TextMesh[] textMeshes = gameObject.GetComponentsInChildren<TextMesh>(); foreach(TextMesh text in textMeshes) { if(text.gameObject.name == "name text") { text.fontSize = SmallCardTitleFontSize; text.text = card.DisplayName; } else { text.fontSize = SmallCardRulesFontSize; text.text = card.MiniDisplayText; } if(card.God == ShopControl.Gods.Ekcha | card.God == ShopControl.Gods.Ixchel) { text.color = new Color(1, 1, 1); } } CardText[] cardTexts = gameObject.GetComponentsInChildren<CardText>(); SpriteRenderer[] renders = gameObject.GetComponentsInChildren<SpriteRenderer>(); foreach(SpriteRenderer render in renders) { if (render.gameObject.tag == "cardback") { continue; } else if (render.gameObject.name == "picture") { if (card.IconPath != "") { render.sprite = Resources.Load<Sprite>(card.IconPath); } } else if (render.gameObject.name == "rarity") { switch (card.ThisRarity) { case Card.Rarity.Gold: render.sprite = S.ShopControlGUIInst.Gold; break; case Card.Rarity.Silver: render.sprite = S.ShopControlGUIInst.Silver; break; case Card.Rarity.Bronze: render.sprite = S.ShopControlGUIInst.Bronze; break; case Card.Rarity.Paper: render.sprite = S.ShopControlGUIInst.Paper; break; } } else if (render.gameObject.name == "god icon") { int godnum = ShopControl.AllGods.IndexOf(card.God); render.sprite = S.ShopControlGUIInst.SpriteGodIcons[godnum]; } else if (render.gameObject.name == "shine animation") { ShineAnim = render.gameObject.GetComponent<ShineAnimation>(); } else if (render.gameObject.name == "shine animation 2") { continue; } else if (render.gameObject.name == "glow") { Glow = render.gameObject.GetComponent<SpriteRenderer>(); } else if (render.gameObject.name == "aoe icon" | render.gameObject.name == "range icon" ) { string resourceLoadTarget = "sprites/targeting icons/"; float baseIconSize = 2.4f; if(render.gameObject.name == "range icon") { if(card.rangeTargetType == GridControl.TargetTypes.none) continue; resourceLoadTarget += ("range " + card.rangeTargetType.ToString() + " " + card.minRange.ToString() + "-" + card.maxRange.ToString()); baseIconSize = baseIconSize / (card.maxRange*2+1); } else if(render.gameObject.name == "aoe icon") { if(card.aoeTargetType == GridControl.TargetTypes.none) continue; resourceLoadTarget += ("aoe " + card.aoeTargetType.ToString() + " " + card.aoeMinRange.ToString() + "-" + card.aoeMaxRange.ToString()); baseIconSize = baseIconSize / (card.aoeMaxRange*2+1); } render.sprite = Resources.Load<Sprite>(resourceLoadTarget); render.gameObject.transform.localScale = new Vector3(baseIconSize, baseIconSize, 0); } else if (render.gameObject.name != "picture") { int godnum = 3; godnum = ShopControl.AllGods.IndexOf(card.God); render.sprite = S.ShopControlGUIInst.GodSmallCards[godnum]; } } foreach (CardText cardText in cardTexts) cardText.Initialize(101 - card.HandIndex() * 2); //Sets up font sizes string[] words = card.CardName.Split (' '); int longestWordLength = words [0].Length; for (int i = 0; i < words.Length; i++) { if(words[i].Length > longestWordLength) longestWordLength = words[i].Length; } if (longestWordLength > FontVariableMaxTitleWordLength) { SmallCardTitleFontSize = SmallCardTitleFontSize*FontVariableMaxTitleWordLength/longestWordLength; DisplayTitleFontSize = DisplayTitleFontSize*FontVariableMaxTitleWordLength/longestWordLength; } if (card.DisplayText.Length > FontVariableMaxRulesLength) { // ultimate font size = maxlength - (difference * ratio) DisplayRulesFontSize = DisplayRulesFontSize - ((card.DisplayText.Length - FontVariableMaxRulesLength) / SmallCardFontVariableRulesSizeRatio); } if (card.MiniDisplayText.Length > FontVariableMaxMiniRulesLength) { SmallCardRulesFontSize = SmallCardRulesFontSize - ((card.DisplayText.Length - FontVariableMaxRulesLength) / DisplayFontVariableRulesSizeRatio); } }
void Awake() { if (Application.platform == RuntimePlatform.IPhonePlayer) { Debug.Log("on iphone"); // System.Environment.SetEnvironmentVariable("MONO_REFLECTION_SERIALIZER", "yes"); Debug.Log("didn't error"); } EventControl.NewLevelReset (); QControl.Initialize (); playsLeftText = GameObject.Find ("plays left #").GetComponent<TextMesh> (); movesLeftText = GameObject.Find ("moves left #").GetComponent<TextMesh> (); dollarsText = GameObject.Find ("Dollar count").GetComponent<TextMesh> (); deckText = GameObject.Find ("Deck count").GetComponent<TextMesh> (); playButton = GameObject.Find ("play end button").GetComponent<ButtonAnimate> (); moveButton = GameObject.Find ("move end button").GetComponent<ButtonAnimate> (); endTurnButton = GameObject.Find ("end turn button").GetComponent<ButtonAnimate> (); handObj = GameObject.Find ("Hand"); playBoardObj = GameObject.Find ("Play board"); playerObj = GameObject.FindGameObjectWithTag ("Player"); player = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> (); gooeyskin = (GUISkin)Resources.Load ("GUISkins/S.GameControlInst.guiskin"); SaveDataControl.Load (); StateSavingControl.Initialize (this, player); if(SaveDataControl.UnlockedCards.Count == 0 | SaveDataControl.UnlockedGods.Count == 0) { SaveDataControl.NewSaveFile (); } MainMenu.UnlockCheck(); }
/// <summary> /// Main method 2; Executes whatever action is set to happen /// </summary> public void ReleaseCursor() { switch (currentCursorAction) { case CursorActions.Info: ShowInfo(); break; case CursorActions.StairMove: if (S.GameControlInst.MovesLeft > 0) { S.GameControlInst.AddMoves(-1); S.ShopControlInst.GoalCheck("Move X times in one turn"); S.ShopControlInst.GoalCheck("Don't move X turns in a row"); S.ShopControlInst.GoalCheck("Don't deal damage or move X turns in a row"); S.ShopControlInst.GoalCheck("Don't move X turns in a row"); } else { ButtonAnimate moveButton = GameObject.Find("move end button").GetComponent <ButtonAnimate>(); moveButton.ErrorAnimation(); } break; case CursorActions.Move: if (walkableObstacleToWalkInto != null) { walkableObstacleToWalkInto.StepIn(); } if (moveDirection != null) { playerObject.GetComponent <Player>().MoveClick(moveDirection); } else { Debug.LogError("there should be a move direction set already. oops"); } break; case CursorActions.Poke: GridUnit playerGU = playerObject.GetComponent <GridUnit>(); playerGU.PokeTowards(playerGU.AdjacentPosition(currentCursorTarget.GetComponent <GridUnit>())); break; case CursorActions.Punch: playerObject.GetComponent <Player>().Punch(currentCursorTarget); break; case CursorActions.TargetSquare: TargetSquare square = currentCursorTarget.GetComponent <TargetSquare>(); if (Tutorial.TutorialLevel != 0) { if (square.XCoor == 0 && square.YCoor == -2) { S.GameControlInst.gameObject.GetComponent <Tutorial>().TutorialTrigger(5); } else { S.GameControlInst.gameObject.GetComponent <Tutorial>().TutorialMessage = "iolksdcbelp"; return; } } S.GameControlInst.TargetSquareCallback.TargetSquareCalledThis(square.XCoor, square.YCoor); break; case CursorActions.None: break; default: Debug.Log("shouldn't be showing info! bug!"); break; } UnpresentCursor(); }
void Start() { useGUILayout = false; playerObject = GameObject.FindGameObjectWithTag ("Player"); playButton = GameObject.Find ("play end button").GetComponent<ButtonAnimate> (); displayCardCanvas = GameObject.FindGameObjectWithTag("displaycard").GetComponent<DisplayCardCanvas>(); eventSystem = GameObject.FindGameObjectWithTag("eventsystem").GetComponent<EventSystem>(); }