Beispiel #1
0
        // --------------------------------------------------------------------------------------------
        private void Initializing_Enter()
        {
            _sun = SharpLight.Sun();
            _sun.Render(transform);

            _mainCamera = SharpCamera.Main();
            _mainCamera.Render(transform);
            _mainCamera.GameObject.SetActive(false);

            _mainCanvas = SharpCanvas.RenderScreenSpaceOverlay("MainCanvas", ReferenceResolution, gameObject.transform);
        }
Beispiel #2
0
        // --------------------------------------------------------------------------------------------
        public Game(List <PlayerData> playerDatas, int localPlayerIndex)
        {
            _currentPlayerIndex = 0;
            _localPlayerIndex   = localPlayerIndex;

            // TODO: when networked, we need to share this in the room properites and then deserialize it on all clients
            _random = SerializedRandom.CreateNewInstance(1024);

            board = new Board(this, 5, 5);
            board.Render(AppManager.Transform);

            sun = SharpLight.Sun();
            sun.LocalRotation = Quaternion.Euler(125, 45, 0);
            sun.Render(AppManager.Transform);

            _players = new List <Player>();
            for (int i = 0; i < playerDatas.Count; i++)
            {
                // TODO: players need to have a synced initial seed
                Player player = new Player(playerDatas[i], this, i, (uint)i);
                player.PlayerLost += OnPlayerLost;
                _players.Add(player);
            }

            // This needs to happen before gameCamera, since it needs to register itself as a listener to UIWorldIteractionPanel
            _uiWorldInteractionPanel = UIWorldInteractionPanel.Create(this);

            _unitActionManager = new UnitActionManager(this, this);
            UIWorldInteractionPanel.AddListener(_unitActionManager);

            gameCamera = GameCamera.Create(this, -90, board.CenterPos + Vector3.down * BoardTileView.Size / 2f);
            gameCamera.Render(AppManager.Transform);

            _playerActions = new List <PlayerAction>();
            _actionIndex   = -1;

            _hudManager = HUDManager.Create(this);
            _hudManager.Render(AppManager.Transform);
        }