Esempio n. 1
0
    void AlignToCamera()
    {
        // Align score
        tmpPos   = score.transform.localPosition;
        tmpPos.y = -Camera.main.orthographicSize;
        tmpPos.x = -(Camera.main.aspect * Camera.main.orthographicSize);
        score.transform.localPosition = tmpPos;

        // Align score label
        tmpPos   = ScoreLabel.transform.localPosition;
        tmpPos.y = score.transform.localPosition.y + (score.GetEstimatedMeshBoundsForString(score.text).size.y * 1.1f);
        tmpPos.x = score.transform.localPosition.x;
        ScoreLabel.transform.localPosition = tmpPos;

        // Align bonus
        tmpPos   = Bonus.transform.localPosition;
        tmpPos.y = ScoreLabel.transform.localPosition.y + ScoreLabel.GetBounds().size.y;
        tmpPos.x = score.transform.localPosition.x;
        Bonus.transform.localPosition = tmpPos;

        // Align bonus label
        tmpPos   = BonusLabel.transform.localPosition;
        tmpPos.y = Bonus.transform.localPosition.y + (Bonus.GetEstimatedMeshBoundsForString(Bonus.text).size.y * 1.1f);
        tmpPos.x = score.transform.localPosition.x;
        BonusLabel.transform.localPosition = tmpPos;

        lastAspect = Camera.main.aspect;
    }