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(); }
public void StartNewTurn(bool loadedFromSaveState) { if (!player.alive) { return; } S.GameControlGUIInst.Dim(false); //DIFFERENT IN TUTORIAL! if (Tutorial.TutorialLevel == 0) { if (!loadedFromSaveState) { foreach (Goal g in S.ShopControlInst.Goals) { g.NewTurnCheck(); } NewTurnCheckWoundsDrawAddMovesAndPlays(); EventControl.NewTurnReset(); //sets enemy's moves and actions to their max, preparing them for their turn. GameObject[] enemies = GameObject.FindGameObjectsWithTag("Enemy"); foreach (GameObject badguy in enemies) { Enemy en = badguy.GetComponent <Enemy>(); if (en != null) { en.GoToMaxPlays(); } } StateSavingControl.Save(); } UICheck(); S.ClickControlInst.turnEndedAlready = false; S.ClickControlInst.AllowEveryInput(); S.ClickControlInst.cardScriptClickedOn = null; } }
public void Discard() { if (Discarded) { Debug.LogError("Trying to discard a card which is already marked as discarded. Bug?"); return; } bool actuallyDiscarding = DiscardWhenPlayed | ForcingDiscardOfThis; if (actuallyDiscarding) { S.GameControlInst.Hand.Remove(gameObject); S.GameControlInst.Discard.Add(gameObject); Discarded = true; StateSavingControl.Save(); } cardUI.DiscardAnimate(); }
//base method void LoadObstacleBase(string ObstacleName, int xPosition, int yPosition, string Tooltip) { if (obstacleParent == null) { obstacleParent = GameObject.Find("Obstacles"); } string ObstacleToLoad = "prefabs/obstacles/" + ObstacleName; GameObject tempGO = (GameObject)Instantiate((GameObject)Resources.Load(ObstacleToLoad)); tempGO.GetComponent <GridUnit>().xPosition = xPosition; tempGO.GetComponent <GridUnit>().yPosition = yPosition; tempGO.transform.position = new Vector3(xPosition, yPosition, 0); tempGO.transform.parent = obstacleParent.transform; tempGO.GetComponent <Obstacle>().SetTooltip(Tooltip); StateSavingControl.AddObstacle(xPosition, yPosition); }
//public method, called by gridcontrol public void LoadObstaclesIfExist(LevelTypes levelType) { // State saving stuff here StateSavingControl.ResetObstacleList(); CurrentLevelType = levelType; string tooltip; if (levelType == LevelTypes.Rocks | levelType == LevelTypes.FewRocks) { tooltip = "A sturdy rock. Won't break, even if you punch it."; int numberOfRocks = Random.Range(0, 30); if (levelType == LevelTypes.FewRocks && numberOfRocks > 9) { numberOfRocks = 9; } else if (numberOfRocks > 20) { numberOfRocks = 20; } GridControl.PossibleSpawnPoints = S.GridControlInst.EmptyPathSpots(); for (int i = 0; i < numberOfRocks; i++) { LoadObstacle("Rock", tooltip); } } else if (levelType == LevelTypes.ScorpionRiver) { LoadObstacleSet("Scorpion river"); } else if (levelType == LevelTypes.BloodRiver) { LoadObstacleSet("Blood river"); } else if (levelType == LevelTypes.PusRiver) { LoadObstacleSet("Pus river"); } // else return; (don't load anything if the type is something not covered here) }
public void Buy() { Debug.Log("buy"); S.ShopControlInst.BoughtCardFromGod(GODNUMBER); S.ShopControlInst.RemoveBoughtCard(title.text); background.gameObject.SetActive(false); showThisCardButton.gameObject.SetActive(false); buyingThisCardBackground.gameObject.transform.parent.gameObject.SetActive(false); costBarDescription.gameObject.transform.parent.gameObject.SetActive(false); boughtThisCardDialog.gameObject.SetActive(true); if (S.GameControlInst.Dollars >= thisCard.Cost) { string tempString = thisCard.CardName.ToString(); S.GameControlInst.Deck.Add(tempString); S.GameControlInst.AddDollars(-thisCard.Cost); if (SaveDataControl.TryToUnlockCard(thisCard)) { boughtThisCardText.text = ("Added " + thisCard.God.ToString() + "'s card " + tempString + " to your deck as well as your collection!"); boughtThisCardDialog.sprite = S.ShopGridCanvasInst.BOUGHTSPRITEADDEDTOCOLLECTION; } else { boughtThisCardText.text = ("This card has been added to your deck!"); boughtThisCardDialog.sprite = S.ShopGridCanvasInst.BOUGHTSPRITENORMAL; } Invoke("HideThisCard", 2.0f); StateSavingControl.Save(); } else { boughtThisCardText.text = ("You don't have enough money! This card costs $" + thisCard.Cost.ToString() + "."); boughtThisCardDialog.sprite = S.ShopGridCanvasInst.BOUGHTSPRITENORMAL; } StateSavingControl.Save(); }
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(); } }
public void TurnOnShopGUI() { highScoreNotification = new bool[S.ShopControlInst.Goals.Length]; for (int i = 0; i < S.ShopControlInst.Goals.Length; i++) { if (SaveDataControl.CheckForHighScores(S.ShopControlInst.Goals[i])) { highScoreNotification[i] = true; } } IgnoreClicking = true; S.ShopAndGoalParentCanvasInst.SetUpShopRows(); StateSavingControl.TurnShopModeOn(); StateSavingControl.Save(); S.ShopAndGoalParentCanvasInst.TurnOnShopGUI(); }
/// <summary> /// Load enemies, Invisibledraw 3 cards, start turn. /// </summary> public void StartNewLevel(bool loadedFromSaveState = false) { handObj.transform.localPosition = new Vector3(-0.8f, 0, 0); if (!loadedFromSaveState) { playerObj.GetComponent <GridUnit> ().xPosition = 0; playerObj.GetComponent <GridUnit> ().yPosition = 0; Camera.main.transform.position = new Vector3(0, -1, -10); playerObj.transform.position = new Vector3(0, 0, 0); //DIFFERENT IN TUTORIAL! if (Tutorial.TutorialLevel == 0) { Level++; int numberOfGods = (Level < 3) ? Level : 3; S.ShopControlInst.NewLevelNewGoals(numberOfGods); S.GridControlInst.LoadEnemiesAndObstacles(Level); InvisibleDraw(); InvisibleDraw(); InvisibleDraw(); } EventControl.NewLevelReset(); } StateSavingControl.TurnShopModeOff(); S.ClickControlInst.AllowInputUmbrella = false; S.GameControlGUIInst.UnlockDim(); S.GameControlGUIInst.Dim(false); StartNewTurn(loadedFromSaveState); }
public void DestroyThisGameObject() { RemoveFromTriggerList(); StateSavingControl.RemoveFromTriggerList(CardName); Destroy(gameObject); }
public static void CheckQ() { if (CardQ.Count != MethodQ.Count) { Debug.Log("YOU F****D UP BIGTIME"); return; } if (CardQ.Count == 0) { S.ClickControlInst.AllowEveryInput(); Debug.Log("Checked Q and allowed every input! This is where card effects terminate and EndTurnCheck() is called."); S.GameControlGUIInst.AnimateCardsToCorrectPositionInSeconds(.15f); S.GameControlInst.CheckDeckCount(); // Checks if the turn is over, and if it is, takes the enemy's turn. if (!S.GameControlInst.EndTurnCheck()) { // The player's turn is not over yet StateSavingControl.Save(); } return; } Card deQCard = CardQ.Dequeue(); QMethodType deQMethod = MethodQ.Dequeue(); switch (deQMethod) { case QMethodType.Activate: deQCard.Activate(false); break; case QMethodType.FreeActivate: if (deQCard.CardAction == Card.CardActionTypes.TargetGridSquare) { deQCard.FreeTargetSquare = true; deQCard.Activate(true); } else if (deQCard.CardAction == Card.CardActionTypes.Armor) { deQCard.Activate(true); } else { Debug.Log("what is happening here?"); } break; case QMethodType.Option: deQCard.OptionQCall(); break; case QMethodType.Special: deQCard.SpecialQCall(); break; case QMethodType.FreeSpecial: deQCard.SpecialQCall(); break; case QMethodType.Discard: deQCard.Discard(); break; } }
public static void AddToTriggerList(Card addedCard) { TriggerList.Add(addedCard); StateSavingControl.AddToTriggerList(addedCard.CardName); StateSavingControl.Save(); }
////////////////////// /// utilities ////////////////////// public static void RemoveFromLists(Card removedCard) { TriggerList.Remove(removedCard); StateSavingControl.RemoveFromTriggerList(removedCard.CardName); StateSavingControl.Save(); }
public static void NewLevelReset() { TriggerList = new List <Card> (); StateSavingControl.ResetTriggerList(); // StateSavingControl.Save(); }