void Start() { Debug.Log("InitMainMenu Start"); AddNotificationObservers(); ClearGraphics(); ResetDebugText(); RefreshDebugText(); RefreshGoldCount(0); RefreshOilCount(0); RefreshHiScore(); UpdateFBIcon(); PropellerProduct _propellerProductScript = getPropellerProductClass(); _propellerProductScript.updateLoginText(); if (sComingFromTitle == true) { UpdatePropellerSDK(); sComingFromTitle = false; } if (_propellerProductScript.tryLaunchFuelSDK()) { // obtained multiplayer match data // Fuel is being launched to see results if (AutoLauncher.Instance().AutoLaunch()) { // should never get to here // we have an auto launch condition // reset the state since we are already launching AutoLauncher.Instance().SetAutoLaunch(false); } } else { // no multiplayer match data if (AutoLauncher.Instance().AutoLaunch()) { // we have an auto launch condition // process auto launch condition normally AutoLauncher.Instance().SetAutoLaunch(false); GameObject fuelHandlerObject = GameObject.Find("FuelHandlerObject"); FuelHandler fuelHandler = fuelHandlerObject.GetComponent <FuelHandler>(); fuelHandler.launchPropeller(); } } }
private void ClearGraphics() { //trans overlay GameObject gameObj = GameObject.Find("transoverlay"); gameObj.GetComponent <Renderer>().enabled = false; //init particles to off GameObject particleObj = GameObject.Find("VirtualGoodGoldParticles"); ParticleSystem psystem = (ParticleSystem)particleObj.GetComponent(typeof(ParticleSystem)); psystem.Stop(); particleObj = GameObject.Find("VirtualGoodOilParticles"); psystem = (ParticleSystem)particleObj.GetComponent(typeof(ParticleSystem)); psystem.Stop(); //hide challenge count pieces gameObj = GameObject.Find("ccbacking"); gameObj.GetComponent <Renderer>().enabled = false; GameObject ccountObj = GameObject.Find("ChallengeCount"); TextMesh tmesh = (TextMesh)ccountObj.GetComponent(typeof(TextMesh)); tmesh.GetComponent <Renderer>().enabled = false; //hide trophy gameObj = GameObject.Find("Trophy"); gameObj.GetComponent <Renderer>().enabled = false; //parcipitation trophy gameObj = GameObject.Find("ShowTrophy"); gameObj.GetComponent <Renderer>().enabled = false; gameObj = GameObject.Find("TournyNameText"); tmesh = (TextMesh)gameObj.GetComponent(typeof(TextMesh)); tmesh.GetComponent <Renderer>().enabled = false; gameObj = GameObject.Find("StartDateText"); tmesh = (TextMesh)gameObj.GetComponent(typeof(TextMesh)); tmesh.GetComponent <Renderer>().enabled = false; gameObj = GameObject.Find("EndDateText"); tmesh = (TextMesh)gameObj.GetComponent(typeof(TextMesh)); tmesh.GetComponent <Renderer>().enabled = false; PropellerProduct _propellerProductScript = getPropellerProductClass(); bool _isDynamics = _propellerProductScript.isDynamicsOnly(); if (_isDynamics == true) { gameObj = GameObject.Find("buttonMultiPlayer"); gameObj.transform.position = new Vector3(-24.0f, 1.0f, 0.0f); gameObj.GetComponent <Renderer>().enabled = false; } }
public void UpdatePropellerSDK() { PropellerProduct _propellerProductScript = getPropellerProductClass(); _propellerProductScript.syncUserValues(); _propellerProductScript.SyncChallengeCounts(); _propellerProductScript.SyncTournamentInfo(); _propellerProductScript.SyncVirtualGoods(); }
void OnMouseOver() { if (Input.GetMouseButtonDown(0)) { clickSound.Play(); PropellerProduct _propellerProduct = getPropellerProductClass(); gameObject.GetComponent <SpriteRenderer>().sprite = imgDown; _propellerProduct.launchSinglePlayerGame(); } }
void resetDynamicData() { PropellerProduct _propellerProductScript = getPropellerProductClass(); gameTimerValue = (float)_propellerProductScript.getGameTime(); int _gearShapeType = _propellerProductScript.getGearShapeType(); float _gearFriction = _propellerProductScript.getGearFriction(); GameObject _gearAction = GameObject.Find("GearProxy1"); gearAction _gearActionScript = _gearAction.GetComponent <gearAction>(); _gearActionScript.Reset(_gearShapeType, _gearFriction); }
public void RefreshDebugText() { PropellerProduct _propellerProductScript = getPropellerProductClass(); int _gameTime = (int)_propellerProductScript.getGameTime(); int _gearShapeType = _propellerProductScript.getGearShapeType(); float _gearFriction = _propellerProductScript.getGearFriction(); int showdebug = _propellerProductScript.getShowDebug(); string _split1name = _propellerProductScript.getSplit1Name(); bool enabled = false; if (showdebug == 1) { enabled = true; } GameObject textMesh = GameObject.Find("DebugText1"); TextMesh tmesh = (TextMesh)textMesh.GetComponent(typeof(TextMesh)); tmesh.text = "friction = " + _gearFriction.ToString(); tmesh.GetComponent <Renderer>().enabled = enabled; textMesh = GameObject.Find("DebugText2"); tmesh = (TextMesh)textMesh.GetComponent(typeof(TextMesh)); tmesh.text = "geartype = " + _gearShapeType.ToString(); tmesh.GetComponent <Renderer>().enabled = enabled; textMesh = GameObject.Find("DebugText3"); tmesh = (TextMesh)textMesh.GetComponent(typeof(TextMesh)); tmesh.text = "gametime = " + _gameTime.ToString(); tmesh.GetComponent <Renderer>().enabled = enabled; textMesh = GameObject.Find("DebugText4"); tmesh = (TextMesh)textMesh.GetComponent(typeof(TextMesh)); tmesh.text = "group = " + _split1name.ToString(); tmesh.GetComponent <Renderer>().enabled = enabled; textMesh = GameObject.Find("Environment"); tmesh = (TextMesh)textMesh.GetComponent(typeof(TextMesh)); tmesh.GetComponent <Renderer>().enabled = enabled; textMesh = GameObject.Find("Complete"); tmesh = (TextMesh)textMesh.GetComponent(typeof(TextMesh)); tmesh.GetComponent <Renderer>().enabled = enabled; textMesh = GameObject.Find("UserPrefs"); tmesh = (TextMesh)textMesh.GetComponent(typeof(TextMesh)); tmesh.GetComponent <Renderer>().enabled = enabled; }
void UpdateFBIcon() { PropellerProduct _propellerProductScript = getPropellerProductClass(); int fbicon = _propellerProductScript.getFBIcon(); if (fbicon == 0) { GameObject gameObj = GameObject.Find("FBButton"); gameObj.transform.position = new Vector3(13.08f, -5.14f, 5.0f); gameObj.GetComponent <Renderer>().enabled = true; gameObj = GameObject.Find("LoginStatusText"); gameObj.transform.position = new Vector3(13.08f, -3.41f, 4.0f); gameObj.GetComponent <Renderer>().enabled = true; } }
private PropellerProduct getPropellerProductClass() { GameObject _propellerProductObj = GameObject.Find("PropellerProduct"); if (_propellerProductObj != null) { PropellerProduct _propellerProductScript = _propellerProductObj.GetComponent <PropellerProduct> (); if (_propellerProductScript != null) { return(_propellerProductScript); } throw new Exception(); } throw new Exception(); }
void Start() { mGameState = eGameState.Init; //set match data //FuelHandler _fuelHandlerScript = getFuelHandlerClass(); //GameMatchData _data = _fuelHandlerScript.getMatchData(); PropellerProduct _propellerProductScript = getPropellerProductClass(); GameMatchData _data = _propellerProductScript.getMatchData(); if (_data.ValidMatchData == true) { updateYourAvatarText(_data.YourNickname); updateTheirAvatarText(_data.TheirNickname); updateMatchRoundText("Round - " + _data.MatchRound.ToString()); GameObject _gameObj = GameObject.Find("yourAvatar"); StartCoroutine(downloadImgX(_data.YourAvatarURL, _gameObj)); _gameObj = GameObject.Find("theirAvatar"); StartCoroutine(downloadImgX(_data.TheirAvatarURL, _gameObj)); } else //Single Player { updateYourAvatarText("You"); updateTheirAvatarText("Computer"); updateMatchRoundText("Round - X"); } GameObject _backObj = GameObject.Find("backButton"); _backObj.GetComponent <Renderer>().enabled = false; //Timeup Popup GameObject _timeup = GameObject.Find("TimeUpPopup"); _timeup.GetComponent <Renderer>().enabled = false; _timeup = GameObject.Find("finalScore"); _timeup.GetComponent <Renderer>().enabled = false; gameoverTimer = 0.0f; }
/* * ----------------------------------------------------- * Awake * ----------------------------------------------------- */ void Awake() { Debug.Log("PropellerProduct Awake"); if (Instance != null && Instance != this) { //destroy other instances Destroy(gameObject); } else if (Instance == null) { } Instance = this; DontDestroyOnLoad(gameObject); }
public void RefreshHiScore() { if (PlayerPrefs.HasKey("hiScore")) { PropellerProduct _propellerProductScript = getPropellerProductClass(); GameMatchData _gameMatchData = _propellerProductScript.getMatchData(); int score = _gameMatchData.MatchScore; var _score = PlayerPrefs.GetInt("hiScore"); if (score > _score) { _score = score; PlayerPrefs.SetInt("hiScore", _score); } GameObject gameObj = GameObject.Find("HiScore"); TextMesh t = (TextMesh)gameObj.GetComponent(typeof(TextMesh)); t.text = _score.ToString(); } }
public void ResetDebugText() { PropellerProduct _propellerProductScript = getPropellerProductClass(); int showdebug = _propellerProductScript.getShowDebug(); bool enabled = false; if (showdebug == 1) { enabled = true; } GameObject textMesh = GameObject.Find("DebugText1"); TextMesh tmesh = (TextMesh)textMesh.GetComponent(typeof(TextMesh)); tmesh.text = "Dynamics"; tmesh.GetComponent <Renderer>().enabled = enabled; textMesh = GameObject.Find("DebugText2"); tmesh = (TextMesh)textMesh.GetComponent(typeof(TextMesh)); tmesh.text = "returning"; tmesh.GetComponent <Renderer>().enabled = enabled; textMesh = GameObject.Find("DebugText3"); tmesh = (TextMesh)textMesh.GetComponent(typeof(TextMesh)); tmesh.text = "null"; tmesh.GetComponent <Renderer>().enabled = enabled; textMesh = GameObject.Find("DebugText4"); tmesh = (TextMesh)textMesh.GetComponent(typeof(TextMesh)); tmesh.text = "split1name"; tmesh.GetComponent <Renderer>().enabled = enabled; textMesh = GameObject.Find("VersionText"); tmesh = (TextMesh)textMesh.GetComponent(typeof(TextMesh)); tmesh.GetComponent <Renderer>().enabled = enabled; }
void Update() { switch (mGameState) { case eGameState.Init: { scoreValue = 0; gameTimerValue = 10.0f; resetDynamicData(); InitTextMeshObjs(); mGameState = eGameState.Ready; } break; case eGameState.Ready: { //waiting for first tap } break; case eGameState.FirstTap: { GameObject _tapsCounter = GameObject.Find("TapsCounter"); Animator _Animator = _tapsCounter.GetComponent <Animator>(); _Animator.Play("tapCountDisplayAnim2"); _tapsCounter = GameObject.Find("MPSCounter"); _Animator = _tapsCounter.GetComponent <Animator>(); _Animator.Play("tapCountDisplayAnim2"); mGameState = eGameState.Running; } break; case eGameState.Running: { //update gameTimer gameTimerValue -= Time.deltaTime; GameObject _gearAction = GameObject.Find("GearProxy1"); gearAction _gearActionScript = _gearAction.GetComponent <gearAction>(); if (gameTimerValue <= 0) { mGameState = eGameState.Done; gameTimerValue = 0.0f; hideStartButtonText(); int maxspeed = (int)_gearActionScript.maxspinvelocity; PropellerProduct _propellerProductScript = getPropellerProductClass(); _propellerProductScript.SetMatchScore(scoreValue, maxspeed); GameObject _backObj = GameObject.Find("backButton"); _backObj.GetComponent <Renderer>().enabled = true; //reset animations GameObject _tapsCounter = GameObject.Find("TapsCounter"); Animator _Animator = _tapsCounter.GetComponent <Animator>(); _Animator.Play("tapCountDisplayAnim"); _tapsCounter = GameObject.Find("MPSCounter"); _Animator = _tapsCounter.GetComponent <Animator>(); _Animator.Play("tapCountDisplayAnim"); //bring the system to a grinding halt _gearActionScript.SetFriction(0.96f); _gearActionScript.ClearActiveBonuses(); GameOverSFX.Play(); //Timeup Popup GameObject _timeup = GameObject.Find("TimeUpPopup"); _timeup.GetComponent <Renderer>().enabled = true; updateFinalScoreText(scoreValue.ToString()); _timeup = GameObject.Find("finalScore"); _timeup.GetComponent <Renderer>().enabled = true; //another complete game session if (PlayerPrefs.HasKey("numSessions")) { int numSessions = PlayerPrefs.GetInt("numSessions"); numSessions++; PlayerPrefs.SetInt("numSessions", numSessions); } } //update game timer if (_gearActionScript.Check5secBonus() == true) { gameTimerValue += 5.0f; } updateGameTimerText(gameTimerValue.ToString("0") + " sec"); updateScoreText(scoreValue.ToString()); GameObject spinTextObj = GameObject.Find("speedTextMesh"); TextMesh tmesh = (TextMesh)spinTextObj.GetComponent(typeof(TextMesh)); tmesh.text = _gearActionScript.velocityStr; } break; case eGameState.Done: { //timeout to return to main menu gameoverTimer += Time.deltaTime; if (gameoverTimer >= gameoverTimeout) { InitMainMenu.sComingFromGame = true; Application.LoadLevel("MainMenu"); mGameState = eGameState.Exit; } } break; case eGameState.Exit: { } break; } }