public void Skin2UnlockOrEquip() { cat1Details = gameOptionsObject.GetComponent <Cat1DetailsScript>(); if (!cat1Details.cat1SkinEquipped[1] && cat1Details.cat1SkinsUnlocked[1]) //If we own the skin and it's not equipped { //First set all skins to be unequipped for (int i = 0; i < cat1Details.cat1SkinEquipped.Length; i++) { cat1Details.cat1SkinEquipped[i] = false; } //Then Set the appropriate one to be equipped cat1Details.cat1SkinEquipped[1] = true; } if (!cat1Details.cat1SkinsUnlocked[1]) { gameOptions = gameOptionsObject.GetComponent <GameOptionsScript>(); if (gameOptions.playerSoftCash >= 500) { cat1Details.cat1SkinsUnlocked[1] = true; gameOptions.playerSoftCash -= 500; } } }
public float diffMod; //Multiplier for game difficulty // Use this for initialization void Start() { gameOptionsObject = GameObject.FindGameObjectWithTag("GameOptions"); //Grab the object that contains the options data gameOptions = gameOptionsObject.GetComponent <GameOptionsScript>(); //Grab the game data gameTimerObject = GameObject.FindGameObjectWithTag("Timer"); //Grab the object that contains the options data playerData = gameTimerObject.GetComponent <PlayerDataScript>(); //Grab the game data diffMod = 0.5f; playerData.numPieces = pieceSpawnTime.Length + 1; playerData.numProceed = Mathf.RoundToInt(playerData.numPieces * 0.5f); //Loop for each object in the set for (int i = pieceSpawnTime.Length - 1; i >= 0; i--) { GameObject levelSet = Instantiate(buttonTypes[pieceType[i]], gameObject.transform, false) as GameObject; //levelSet.transform.SetParent(gameObject.transform, false); //levelSet.transform.localScale = new Vector3(1, 1, 1); levelSet.transform.localPosition = pieceLocation[i]; objectActivate = levelSet.GetComponent <ObjectActivateScript>(); objectActivate.spawnTimer = pieceSpawnTime[i]; levelSet.transform.localEulerAngles = pieceRotation[i]; } }
void GameEnd() { playerData = playerDataObject.GetComponent <PlayerDataScript>(); gameCompleteObject.SetActive(true); gameCompleteText = gameCompleteObject.GetComponent <Text>(); int successAmount = (int)playerData.allSuccessRate; int levelScore = (int)playerData.playerScore; //JS int levelHits = (int)playerData.allSuccessfulHits; //JS int levelMisses = (int)playerData.allUnsuccessfulHits; //JS int levelAllHits = (int)playerData.allHits; //JS float missAmount = (100f / levelAllHits) * levelMisses; //JS //gameCompleteText.text = ("Congratulations! You completed the event with " + successAmount.ToString() + "% accuracy and have earned " + successAmount.ToString() + " coins!"); gameOptions = gameOptionsObject.GetComponent <GameOptionsScript>(); //Grab the game data gameOptions.playerSoftCash += successAmount; playerDets.softCurrency += successAmount; playerDets.score += levelScore; levelCompletePanel.SetActive(true); //JS levelEndScoreText.text = levelScore.ToString(); //JS levelEndPerfectsText.text = (levelHits.ToString() + "(" + successAmount.ToString() + "%)"); //JS levelEndMissesText.text = (levelMisses.ToString() + "(" + missAmount.ToString() + "%)"); //JS levelEndRewardText.text = (successAmount.ToString()); // Cat needs to go to trigger Win here }
// Use this for initialization void Start() { gameDataObject = GameObject.FindGameObjectWithTag("GameData"); gameOptions = gameDataObject.GetComponent <GameOptionsScript>(); playerDetails = gameDataObject.GetComponent <PlayerDetailsScript>(); playerInv = gameDataObject.GetComponent <PlayerInventoryScript>(); playerStable = gameDataObject.GetComponent <PlayerStableScript>(); }
public void ToMainMenu() { Time.timeScale = 1; gameDataObject = GameObject.FindGameObjectWithTag("GameData"); //JS Grab the object that contains the data gameOptionsScript = gameDataObject.GetComponent <GameOptionsScript>(); //JS Grab options data to carry info that player is returning for gameplay gameOptionsScript.returningFromGamePlay = true; SceneManager.LoadScene(1); }
Animator catAnimator; //JS // Use this for initialization void Start() { gameOptionsObject = GameObject.FindGameObjectWithTag("GameOptions"); //Grab the object that contains the options data gameOptions = gameOptionsObject.GetComponent <GameOptionsScript>(); //Grab the game data gameData = GameObject.FindGameObjectWithTag("GameData"); //Grab the object that contains the options data playerDets = gameData.GetComponent <PlayerDetailsScript>(); StartCoroutine(StartTheGame()); }
// Use this for initialization void Start() { gameOptions = gameObject.GetComponent <GameOptionsScript>(); }