Наследование: MonoBehaviour
Пример #1
0
 public void AddObjects()
 {
     levelDisplay = GameObject.Find ("Level").GetComponent<LevelDisplay> ();
     lifeDisplay = GameObject.Find ("Life_Bar").GetComponent<LifeDisplay> ();
     playerDisplay = GameObject.Find ("Ship").GetComponent<PlayerDisplay> ();
     scoreDisplay = GameObject.Find ("Score").GetComponent<ScoreDisplay> ();
     restartButton = GameObject.Find ("Restart_Button").GetComponent<RestartButton> ();
 }
Пример #2
0
    public void Initialize(ScoreDisplay dest, int value)
    {
        Destination = dest;
        Value = value;

        _rect = GetComponent<RectTransform>();
        _destRect = Destination.GetComponent<RectTransform>();

        UIText.text = (value >= 0) ? "+" + value.ToString() : value.ToString();

        UIText.DOFade(0, ScoreManager.Instance.ScoreTextFadeDuration);

        _initialized = true;
    }
    public void CreateScoreText(ScoreDisplay display, Vector3 position, int value)
    {
        Debug.Log("Making score text");
        Vector3 viewportPoint = Camera.main.WorldToViewportPoint(position);

        GameObject clone = Instantiate(ScoreTextPrefab, Vector3.zero, Quaternion.identity) as GameObject;
        ScoreText scoreText = clone.GetComponent<ScoreText>();
        RectTransform rect = clone.GetComponent<RectTransform>();
        rect.SetParent(ScoreTextParent);
        rect.anchorMin = new Vector2(viewportPoint.x, viewportPoint.y);
        rect.anchorMax = new Vector2(viewportPoint.x, viewportPoint.y);
        rect.anchoredPosition = Vector3.zero;
        rect.localScale = Vector3.one;

        scoreText.Initialize(display, value);
    }
Пример #4
0
    void Update()
    {
        if (scoreDisplay == null)
        {
            GameObject canvas = GameObject.Find("ScoreCanvas");
            scoreDisplay = canvas.GetComponent<ScoreDisplay>();
        }
        else
        {
            for (int i = 0; i < names.Count; i++)
            {
                ScoreDisplay.Score score = new ScoreDisplay.Score(names[i], scores[i], i);
                scoreDisplay.AddScore(score);
            }

            scoreDisplay.DisplayScores();

            Destroy(gameObject);
        }
    }
Пример #5
0
 // Use this for initialization
 void Start()
 {
     pinSetter = GameObject.FindObjectOfType<PinSetter> ();
     ball = GameObject.FindObjectOfType<Ball> ();
     scoreDisplay = GameObject.FindObjectOfType<ScoreDisplay> ();
 }
 void ShakeScoreDisplay(ScoreDisplay display, int scoreDiff)
 {
     display.Shake(ScoreShakeDuration, ScoreShakeStrength * (scoreDiff / 100f), (int) (ScoreShakeVibrato * (scoreDiff / 100f)), ScoreShakeRandomness * (scoreDiff / 100f));
 }
Пример #7
0
 // Use this for initialization
 void Start()
 {
     ps = GameObject.FindObjectOfType <PinSetter> ();
     bm = GameObject.FindObjectOfType <BallMove> ();
     sd = GameObject.FindObjectOfType <ScoreDisplay> ();
 }
Пример #8
0
 // Use this for initialization
 void Start()
 {
     pinSetter    = GameObject.FindObjectOfType <PinSetter>();
     ball         = GameObject.FindObjectOfType <Ball>();
     scoreDisplay = GameObject.FindObjectOfType <ScoreDisplay>();
 }
Пример #9
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
            {
                content = new ContentManager(ScreenManager.Game.Services, "Content");
            }

            base.LoadContent();

            // once the load has finished, we use ResetElapsedTime to tell the game's
            // timing mechanism that we have just finished a very long frame, and that
            // it should not try to catch up.
            ScreenManager.Game.ResetElapsedTime();

            //define and load fonts
            SpriteFont weaponDisplayFont     = content.Load <SpriteFont>("Fonts\\WeaponsDisplayFont");
            SpriteFont messageBoxDisplayFont = content.Load <SpriteFont>("Fonts\\ScoreMessageBoxFont");
            SpriteFont scoreFont             = content.Load <SpriteFont>("Fonts\\PhillySansFont");

            //create a new gameboard to use for 1p
            GameBoard gameBoard = new GameBoard(new Vector2(480, 55), TileSet.LoadAndGetDefaultTileset(content, challenge.GetDifficulty()), challenge.GetDifficulty(), 400, 564, (int)playerIndex1);

            gameBoard.SetScaleTiles(true);
            gameBoard.GetStats().power = this.challenge.StartingPower();
            this.addGameplayScreenObject(gameBoard);

            //check to see if this challenge wants the board to speed up or stay constant speed
            int speedUpTime = challenge.IsSpeedUpEnabled();

            if (speedUpTime > 0)
            {
                gameBoard.SetSpeedUpEnabled(true);
                gameBoard.SetSpeedUpTimer(speedUpTime);
            }
            else
            {
                gameBoard.SetSpeedUpEnabled(false);
            }


            //load all the background imagery
            DetailedSpriteObject infoPanels = new DetailedSpriteObject(content.Load <Texture2D>("Sprites\\BoardComponents\\info_panels_challenges"),
                                                                       new Rectangle(90, 0, 350, 675));

            this.addGameplayScreenObject(infoPanels);

            //define and load the displays
            LevelDisplay             levelDisplay           = new LevelDisplay(new Vector2(385, 75), scoreFont, gameBoard);
            ChallengeStatusDisplay   challengeStatusDisplay = new ChallengeStatusDisplay(new Vector2(115, 180), scoreFont, gameBoard, this.challenge);
            ScoreDisplay             scoreDisplay           = new ScoreDisplay(new Vector2(200, 75), scoreFont, gameBoard);
            ComplexPowerMeterDisplay powerDisplay           = new ComplexPowerMeterDisplay(new Vector2(920, 0), content, messageBoxDisplayFont, gameBoard, false);
            GameMessageBoxDisplay    messageBoxDisplay      = new GameMessageBoxDisplay(250,
                                                                                        300,
                                                                                        new Vector2(105, 338),
                                                                                        messageBoxDisplayFont,
                                                                                        gameBoard,
                                                                                        12);

            this.addGameplayScreenObject(levelDisplay);
            this.addGameplayScreenObject(challengeStatusDisplay);
            this.addGameplayScreenObject(scoreDisplay);
            this.addGameplayScreenObject(powerDisplay);
            this.addGameplayScreenObject(messageBoxDisplay);
        }
 // Use this for initialization
 void Start()
 {
     _pinSetter    = FindObjectOfType <PinSetter>();
     _ball         = FindObjectOfType <Ball>();
     _scoreDisplay = FindObjectOfType <ScoreDisplay>();
 }
Пример #11
0
 void Start()
 {
     game         = FindObjectOfType <Game>();
     scoreDisplay = game.scoreDisplay;
 }