Exemplo n.º 1
0
        private void PrepareUI()
        {
            GameUIScript.Init(settings);
            GameUIScript.SetPlayersCount(settings.players.Length, settings.players.Count(p => p.type == PlayerType.AI));

            var ui = GameUIScript.GetUI();

            for (int i = 0;
                 i < settings.players.Length;
                 i++)
            {
                var p = settings.players[i];

                var z = ui.GetPlayerZone(p);
                p.gridViewport = z.rect;

                if (p.allowGridAngle)
                {
                    p.gridAngle = z.angle;
                }

                GameUIScript.SetScore(i, 0);
                GameUIScript.SetSpeed(i, settings.gridSettings.startLevel);


                if (objectives != null)
                {
                    GameUIScript.SetObjective(p.index, 1, objectives);
                }
            }
        }
Exemplo n.º 2
0
    /// <summary>
    /// Define the "draw" zone
    /// </summary>
    private void SetViewport(Rect r, float angle)
    {
      gridCam.rect = r;
      gridCam.transform.rotation = Quaternion.Euler(0, 0, angle);

      //float preview = Mathf.Abs(settings.previewLines) - (settings.previewLines != 0 ? 0.5f : 0);

      // Display only a bit of the preview
      float preview = (settings.previewLines > 0 ? 0.25f : 0);

      // Center on screen
      gridCam.transform.position = new Vector3(
        transform.position.x + (settings.width / 2f),
        transform.position.y + (settings.height / 2f) + (-preview / 2f),
        gridCam.transform.position.z
      );
      gridCam.orthographicSize = (settings.height + preview) / 2f;

      var gui = GameUIScript.GetUI();
      transform.position += new Vector3(0f, gui.gridRelativePosition.y * gridCam.orthographicSize * 2f);
      transform.localScale = gui.gridScale;
    }