/**
         * <summary>
         * Sets the camera according to the initial position of the player
         * </summary>
         */
        public void SetCameraPosition(int number, int max, NetworkedScene ns)
        {
            PopulateInitialPosition init = PopulateInitialPosition.GetPlayerPosition(number, max, width, height, castleWidth, castleHeight);
            LayerTile tile = Map.map.GetTileByMapCoordinates(init.x + castleWidth / 2, init.y + castleHeight / 2);

            if (tile != null)
            {
                Vector2 pos = tile.LocalPosition + WorldObjectData.center;
                ns.RenderManager.ActiveCamera2D.Transform.Position = pos;
            }
        }
Example #2
0
        public void SetPlayer(Player p, int playerNum, int maxPlayers)
        {
            PopulateInitialPosition initial = PopulateInitialPosition.GetPlayerPosition(playerNum, maxPlayers,
                                                                                        width, height, castleWidth, castleHeight);
            int x = initial.x;
            int y = initial.y;

            UIBehavior.ui.CreateCastleToTile(p, x, y, castleWidth, castleHeight);

            //create person
            for (int i = 0; i < personNum; i++)
            {
                UIBehavior.ui.CreateToTile("Person", x + i, y, p);
            }
        }
        public void SetPlayer(ServerDispatcher disp, Player p, int playerNum, int maxPlayers)
        {
            SendData data = new SendData();

            data.clientId = p.Owner.Name.Substring(6);
            PopulateInitialPosition initial = PopulateInitialPosition.GetPlayerPosition(playerNum, maxPlayers,
                                                                                        width, height, castleWidth, castleHeight);
            int x = initial.x;
            int y = initial.y;


            data.position = Map.map.GetTileByMapCoordinates(x, y).LocalPosition;
            data.creating = "Castle";
            disp.CreateAndSync(data);

            //create person
            data.creating = "Person";
            for (int i = 0; i < personNum; i++)
            {
                data.position = Map.map.GetTileByMapCoordinates(x + i, y).LocalPosition;
                disp.CreateAndSync(data);
            }
        }