private void OnStart() { BackgroundScroll.StopAll(); DeleteEnemies(); ResetScore(); _mainMenu.SetActive(true); _playBtn.SetActive(true); _rePlayBtn.SetActive(false); _shadow.SetActive(false); _inGameScoreText.gameObject.SetActive(false); _player.gameObject.SetActive(false); _gardenGnome.GetComponent <Animator>().SetTrigger(IdleTrigger); _gardenGnome.GetComponent <SpriteRenderer>().sortingOrder = DefaultGnomeSortOrder; _toutorial.SetActive(false); _gameTitle.gameObject.SetActive(true); _gameTitle.text = GameManager.GameName; _gameTitle.fontSize = GameTitleFontSize; _gameTitle.color = GameTitleFontColor; _scoreboardText.gameObject.SetActive(true); _scoreboardText.text = string.Format("{0} {1}", GameManager.BestScoreText, GameManager.Instance.HighScore); _scoreboardText.color = GameManager.Instance.IsNewHighScore ? NewHighScoreFontColor : ScoreboardFontColor; _heart.SetActive(false); _heartText.gameObject.SetActive(false); _unknownItemView.SetActive(false); _intensiveItemView.SetActive(false); _speedUpPlayerView.SetActive(false); _noBombsItemView.SetActive(false); _extraPointsView.SetActive(false); _pointsMultyView.SetActive(false); _extraHeartsView.SetActive(false); }
private void OnRunning() { BackgroundScroll.ScrollAll(); _enemiesDispose = GenerateItems(); _scoreDispose = GameManager.Instance._ScoreChanged.Subscribe(OnScoreChanged); _mainMenu.SetActive(false); _playBtn.SetActive(false); _rePlayBtn.SetActive(false); _shadow.SetActive(false); _inGameScoreText.gameObject.SetActive(true); _player.gameObject.SetActive(true); _player.transform.position = PlayerController.DefaultPlayerStartPosition; _player.GetComponent <Animator>().SetTrigger(MoveStartTrigger); _gardenGnome.GetComponent <Animator>().SetTrigger(IdleTrigger); _gardenGnome.GetComponent <SpriteRenderer>().sortingOrder = DefaultGnomeSortOrder; _toutorial.SetActive(false); _gameTitle.gameObject.SetActive(false); _scoreboardText.gameObject.SetActive(false); _heart.SetActive(false); _heartText.gameObject.SetActive(false); _unknownItemView.SetActive(false); _intensiveItemView.SetActive(false); _speedUpPlayerView.SetActive(false); _noBombsItemView.SetActive(false); _extraPointsView.SetActive(false); _pointsMultyView.SetActive(false); _extraHeartsView.SetActive(false); }
private void OnReady() { BackgroundScroll.RevertEach(ScrollRevertSpeed, null); DeleteEnemies(); ResetScore(); _mainMenu.SetActive(false); _playBtn.SetActive(false); _rePlayBtn.SetActive(false); _shadow.SetActive(true); _inGameScoreText.gameObject.SetActive(false); _player.gameObject.SetActive(true); _player.GetComponent <Animator>().SetTrigger(MoveStartTrigger); _gardenGnome.GetComponent <SpriteRenderer>().sortingOrder = ToutorialGuideSortOrder; _gardenGnome.GetComponent <Animator>().SetTrigger(TalkTrigger); _toutorial.SetActive(true); _gameTitle.gameObject.SetActive(false); _scoreboardText.gameObject.SetActive(false); _heart.SetActive(false); _heartText.gameObject.SetActive(false); _unknownItemView.SetActive(false); _intensiveItemView.SetActive(false); _speedUpPlayerView.SetActive(false); _noBombsItemView.SetActive(false); _extraPointsView.SetActive(false); _pointsMultyView.SetActive(false); _extraHeartsView.SetActive(false); }
void Start() { kBack = BackgroundScroll.Instance; rig_ = GetComponent <Rigidbody>(); rig_.velocity = transform.forward * speed; sound_manager_ = SoundManager.Instance; airplane_ = GameObject.FindWithTag("Airplane"); anim_ = GetComponentInChildren <Animator>(); qtarget_ = transform.rotation.eulerAngles; }
void Start() { kBack = BackgroundScroll.Instance; rig_ = GetComponent<Rigidbody>(); rig_.velocity = transform.forward * speed; sound_manager_ = SoundManager.Instance; airplane_ = GameObject.FindWithTag("Airplane"); anim_ = GetComponentInChildren<Animator>(); qtarget_ = transform.rotation.eulerAngles; }
private void Awake() { if (instance == null) { instance = this; } else if (instance != null) { Destroy(this.gameObject); } }
void Start() { player_ = GetComponent <Rigidbody>(); player_.useGravity = false; boundary_.kXMin = -6f; boundary_.kXMax = 6f; boundary_.kZMin = 0f; boundary_.kZMax = 6f; kSound = SoundManager.Instance; kAudioIn = AudioInputAdapter.Instance; kBack = BackgroundScroll.Instance; }
//Speed boost IEnumerator Speedbump() { // initiate values GameObject background; GameObject generator; background = GameObject.Find(backdropLabel); generator = GameObject.Find("Main Camera"); BackgroundScroll bgScroll = background.GetComponent <BackgroundScroll> (); GenerateLevelSets genLevel = generator.GetComponent <GenerateLevelSets> (); // Boost foreground speed for all generated obstacles foreach (GameObject check in GameObject.FindGameObjectsWithTag(groundTag)) { DestroySet destroySet = check.GetComponent <DestroySet>(); if (destroySet != null) { destroySet.speed = destroySet.fastSpeed; } } // Boost gen object speed while using powerup genLevel.speed = genLevel.fastSpeed; // Boost background speed bgScroll.speed = bgScroll.fastSpeed; // Duration of boost yield return(new WaitForSeconds(speedBumpDuration)); // Boost foreground speed for all generated obstacles foreach (GameObject check in GameObject.FindGameObjectsWithTag(groundTag)) { DestroySet destroySet = check.GetComponent <DestroySet>(); if (destroySet != null) { destroySet.speed = destroySet.normalSpeed; } } // Undo boost to gen object speed genLevel.speed = genLevel.normalSpeed; // Undo boosted speed for background bgScroll.speed = bgScroll.normalSpeed; }
private void CreateBackgroundObjects(List <Background> backgroundList, GameObject backgroundCamera) { BackgroundListData data = AssetDatabase.LoadAssetAtPath <BackgroundListData>( $"{backgroundAssetsPath}/{backgroundListAssetName}.asset"); if (data == null) { Debug.Log("Creating new list object."); data = ScriptableObject.CreateInstance <BackgroundListData>(); data.listName = backgroundListAssetName; foreach (Background background in backgroundList) { BackgroundSettings settings = background.Settings; GameObject backgroundContainer = new GameObject($"{background.SpriteTexture.name}_container"); BackgroundScroll scroll = backgroundContainer.AddComponent <BackgroundScroll>(); scroll.Initialize(settings); GameObject backgroundObject = new GameObject($"{background.SpriteTexture.name}_sprite"); SpriteRenderer renderer = backgroundObject.AddComponent <SpriteRenderer>(); renderer.sprite = background.GetSprite(); // renderer.sortingLayerName = settings.SortLayer; renderer.sortingOrder = settings.OrderInLayer; backgroundObject.transform.SetParent(backgroundContainer.transform); backgroundContainer.transform.SetParent(backgroundCamera.transform); backgroundContainer.transform.position = new Vector3(settings.x, settings.y, 0); data.AddBackground(SavePrefab(backgroundContainer, backgroundAssetsPath, $"{backgroundContainer.name}.prefab")); } SaveAssetToDatabase(data, backgroundAssetsPath, $"{backgroundListAssetName}.asset"); } else { foreach (GameObject backgroundPrefab in data.GetBackgroundPrefabs()) { Instantiate(backgroundPrefab, backgroundCamera.transform); } } }
// Use this for initialization void Start () { // initilate values background = GameObject.Find(backgroundLabel); bgScroll = background.GetComponent<BackgroundScroll> (); speed = 0; speed2 = 0; checkPulledCurrentPlayer = false; checkTetherOtherPlayer = false; // Setup Key Controls Dictionary<string, KeyCode> player1 = new Dictionary<string, KeyCode>(); Dictionary<string, KeyCode> player2 = new Dictionary<string, KeyCode>(); player1.Add ("tether", KeyCode.RightShift); keyControls.Add (player1Label, player1); player2.Add ("tether", KeyCode.LeftShift); keyControls.Add (player2Label, player2); // check which game object it is connnected to if (gameObject.name == player1Label) { currentPlayer = player1Label; otherPlayer = player2Label; } else if (gameObject.name == player2Label) { currentPlayer = player2Label; otherPlayer = player1Label; } // SET pulled animation animatorControlCurrentPlayer = GetComponentInChildren<Animator>(); animatorControlCurrentPlayer.SetBool("Pulled", checkPulledCurrentPlayer); // SET tether animation for player 2 otherPlayerGameObject = GameObject.Find (otherPlayer); animatorControlOtherPlayer = otherPlayerGameObject.GetComponentInChildren<Animator> (); animatorControlOtherPlayer.SetBool ("Tether", checkTetherOtherPlayer); //set clothes to players if (currentPlayer == player1Label) { cloth = GameObject.Find ("Player1_Cloth"); } else { cloth = GameObject.Find ("Player2_Cloth"); } }
void Start() { Application.targetFrameRate = 60; LoadPersistedScores(); Score = 0; alive = true; audioSource = GetComponent <AudioSource>(); balloons = GameObject.FindGameObjectsWithTag("Balloon").ToList(); help = GameObject.Find("help"); if (IsFirstTime) { help.SetActive(true); } IsFirstTime = false; backgroundScroll = FindObjectOfType <BackgroundScroll>(); interaction = FindObjectOfType <Interaction>(); enemyGenerator = FindObjectOfType <EnemyGenerator>(); clouds = FindObjectsOfType <CloudGenerator>(); tinter = FindObjectOfType <BackgroundTinter>(); lives = GameObject.FindGameObjectsWithTag("Balloon").Length; cow = GameObject.Find("Cow"); cowSprite = cow.GetComponent <SpriteRenderer>(); oxygenBar = GameObject.Find("Oxygen Bar").transform; oxygenBarImage = oxygenBar.gameObject.GetComponent <Image>(); txtScore = GameObject.Find("Score Value").GetComponent <Text>(); txtHighScore = GameObject.Find("High Score Value").GetComponent <Text>(); txtAltitude = GameObject.Find("Altitude Value").GetComponent <Text>(); enemies = GameObject.Find("Enemies"); stars = GameObject.Find("Stars"); planets = GameObject.Find("Planets"); oxygens = GameObject.Find("Oxygen Parachutes"); resizes = GameObject.Find("Resize Parachutes"); ResumeGame(false); oxygen = 1; Altitude = 0; lastAltitude = 0; IsHighScore = false; UpdateScoreUI(); }
// Use this for initialization void Start() { // initilate values background = GameObject.Find(backgroundLabel); bgScroll = background.GetComponent <BackgroundScroll> (); speed = 0; speed2 = 0; checkPulledCurrentPlayer = false; checkTetherOtherPlayer = false; // Setup Key Controls Dictionary <string, KeyCode> player1 = new Dictionary <string, KeyCode>(); Dictionary <string, KeyCode> player2 = new Dictionary <string, KeyCode>(); player1.Add("tether", KeyCode.R); keyControls.Add(player1Label, player1); player2.Add("tether", KeyCode.E); keyControls.Add(player2Label, player2); // check which game object it is connnected to if (gameObject.name == player1Label) { currentPlayer = player1Label; otherPlayer = player2Label; } else if (gameObject.name == player2Label) { currentPlayer = player2Label; otherPlayer = player1Label; } // SET pulled animation animatorControlCurrentPlayer = GetComponentInChildren <Animator>(); animatorControlCurrentPlayer.SetBool("Pulled", checkPulledCurrentPlayer); // SET tether animation for player 2 otherPlayerGameObject = GameObject.Find(otherPlayer); animatorControlOtherPlayer = otherPlayerGameObject.GetComponentInChildren <Animator> (); animatorControlOtherPlayer.SetBool("Tether", checkTetherOtherPlayer); }
private void OnEndGame() { _player.gameObject.SetActive(true); _player.GetComponent <Animator>().SetTrigger(MoveEndTrigger); BackgroundScroll.RevertEach(ScrollRevertSpeed, () => { _mainMenu.SetActive(true); _player.gameObject.SetActive(false); _playBtn.SetActive(false); _rePlayBtn.SetActive(true); }); DeleteEnemies(); ResetScore(); _shadow.SetActive(true); _inGameScoreText.gameObject.SetActive(false); //_player.SetActive(false); _gardenGnome.GetComponent <Animator>().SetTrigger(IdleTrigger); _gardenGnome.GetComponent <SpriteRenderer>().sortingOrder = DefaultGnomeSortOrder; _toutorial.SetActive(false); _gameTitle.gameObject.SetActive(true); _gameTitle.text = GameManager.GameOverText; _gameTitle.fontSize = GameOverFontSize; _gameTitle.color = GameOverFontColor; _scoreboardText.gameObject.SetActive(true); _scoreboardText.text = string.Format("{0} {1}{2}{3} {4}", GameManager.ScoreText, GameManager.Instance.Score, Environment.NewLine, GameManager.BestScoreText, GameManager.Instance.HighScore); _scoreboardText.color = GameManager.Instance.IsNewHighScore ? NewHighScoreFontColor: ScoreboardFontColor; _heart.SetActive(false); _heartText.gameObject.SetActive(false); _unknownItemView.SetActive(false); _intensiveItemView.SetActive(false); _speedUpPlayerView.SetActive(false); _noBombsItemView.SetActive(false); _extraPointsView.SetActive(false); _pointsMultyView.SetActive(false); _extraHeartsView.SetActive(false); }
// Use this for initialization void Start() { current = this; }
// Use this for initialization void Start() { kBack = BackgroundScroll.Instance; trot = 150; rot = trot; }
void Awake() { background = GetComponent <BackgroundScroll>(); background.speedScale = StartValue; // Убирает рассинхронизацию значений при старте игры }
void Awake() { background = GetComponent <BackgroundScroll>(); }