/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); font = Content.Load <SpriteFont>("font"); explorerTexture = Content.Load <Texture2D>("explorer"); explorerSprite = new AnimatedSprite(explorerTexture, 32); explorerSprite.Position = new Vector2(300, 250); meterBackgroundTexture = Content.Load <Texture2D>("meterBackground"); healthBar = new TimerBar(meterBackgroundTexture, Color.Red, 10, 0.01f); healthBar.Position = new Vector2(160, 24); distanceBar = new DistanceBar(meterBackgroundTexture, Color.Green, 0, 0.01f); distanceBar.Position = new Vector2(368, 24); random = new Random(); clockTexture = Content.Load <Texture2D>("clock"); clockSprite = new Sprite(clockTexture); clockSprite.Position = new Vector2(random.Next(16, 780), random.Next(64, 400)); }
public void Init() { _rect = transform.GetComponent <RectTransform>(); _textAnimations = transform.Find("FeedbackText").GetComponent <TextAnimations>(); _multiplierText = transform.Find("ScoreHolder/MultiplierText").GetComponent <Text>(); _ballsize = transform.GetComponent <RectTransform>().sizeDelta.x / _MAX_AMOUNT_OF_BALLS_HORIZONTAL; _ballSpawnLocation = 540 / _ASPECT_RATIO / 2; _retryButton = transform.Find("RetryButton").gameObject; _homeButton = transform.Find("HomeButton").gameObject; _showAchievementButton = transform.Find("ShowAchievementEnd").gameObject; _showLeaderboardButton = transform.Find("ShowLeaderBoardEnd").gameObject; _gameOverOverlay = transform.Find("GameOverOverlay").gameObject; _pauseMenu = transform.Find("PauseMenu").gameObject; _pauseButton = transform.Find("PauseButton").gameObject; _pausePlayButton = transform.Find("PauseMenu/UnpauseButton").gameObject; _pauseSoundButton = transform.Find("PauseMenu/SoundButton").gameObject; _pauseGyroscopeButton = transform.Find("PauseMenu/GyroscopeButton").gameObject; _pauseScreenshakeButton = transform.Find("PauseMenu/ScreenshakeButton").gameObject; _pauseHomeButton = transform.Find("PauseMenu/PauseHomeButton").gameObject; _counter = transform.GetComponent <Counter>(); _powerUpsManager = transform.GetComponent <PowerUps>(); _powerUpsManager.Init(); _supportsAccelerometer = SystemInfo.supportsAccelerometer; _supportsGyroscope = SystemInfo.supportsGyroscope; _gravityDirection = _START_GRAVITY_DIRECTION; _ballSpawnArea = transform.Find("BallsHolder/SpawnArea"); _ballsHolder = transform.Find("BallsHolder"); _buttonHolder = transform.Find("ButtonHolder"); _canvasGroup = transform.GetComponent <CanvasGroup>(); _feedbackText = transform.Find("FeedbackText").GetComponent <Text>(); _countDownText = transform.Find("CountdownText").GetComponent <Text>(); _playerScoreText = transform.Find("ScoreHolder/Score").GetComponent <Text>(); _phaseFeedbackText = transform.Find("PhaseFeedbackText").GetComponent <Text>(); _gameOverText = transform.Find("GameOverText").GetComponent <Text>(); _positiveFeedbackStrings = new List <string>(); _negativeFeedbackStrings = new List <string>(); RefreshLanguage(); PhasesManager.Instance.OnPhaseChange += _HandlePhaseChange; _phases = new List <bool>(); _phases = PhasesManager.Instance.phases; _textAnimations = transform.Find("FeedbackText").GetComponent <TextAnimations>(); _textAnimations.Init(); _buttonShake = _buttonHolder.GetComponent <ButtonShake>(); _buttonShake.Init(); _timerBar = transform.Find("TimerBar").GetComponent <TimerBar>(); _timerForTimeGameMode = transform.Find("GameTimer").GetComponent <TimerForTimeGameMode>(); _timerCountdown = transform.Find("GameTimer").gameObject; _buttonHolderCanvasGroup = transform.Find("ButtonHolder").GetComponent <CanvasGroup>(); _tutorialText = transform.Find("Tutorial").gameObject; _tutorialHint = transform.Find("TutorialHint").gameObject.GetComponent <FadeTutorialImage>(); _tutorialHint.Init(); clickableObjects = new List <Button> (); clickableObjects.Add(_pauseButton.GetComponent <Button>()); clickableObjects.Add(_timerBar.GetComponent <Button> ()); clickableObjects.Add(_buttonHolder.transform.GetChild(0).GetChild(0).gameObject.GetComponent <Button> ()); clickableObjects.Add(_buttonHolder.transform.GetChild(0).GetChild(1).gameObject.GetComponent <Button> ()); clickableObjects.Add(_buttonHolder.transform.GetChild(1).GetChild(0).gameObject.GetComponent <Button> ()); clickableObjects.Add(_buttonHolder.transform.GetChild(1).GetChild(1).gameObject.GetComponent <Button> ()); _highestCountofBalls = 0; _secondHighestCountOfBalls = 0; _popupMenu = transform.Find("PopupMenu").gameObject; AchievementsManager.Instance.SetPopupMenu(transform.Find("PopupMenu").gameObject); }
// Use this for initialization void Awake() { _barScript = GameObject.Find("TimerBar").GetComponent <TimerBar>(); _timerText = GameObject.Find("TimeLeftText").GetComponent <Text>(); }