Ejemplo n.º 1
0
        private void Start()
        {
            NetManager = new NetManager();
            NetManager.Connect(new IPEndPoint(IPAddress.Parse("192.168.0.100"), 7999));

            var loginSuccess = NetManager.Login("", "");

            Debug.Log(loginSuccess ? "Logged in successfully" : "Authentication error");

            var vision = NetManager.GetVision();

            var size = vision.Grid.Size();

            Area.Current.Initialize(size);
            BuildingManipulator.InitializeBuildingsGrid(size);

            NewsContainer.OnVisionChanged(vision);

            NetManager.AddResources();
        }
Ejemplo n.º 2
0
        public static void OnVisionChanged(VisionDto vision)
        {
            Debug.Log("Vision is changed");

            var grid = vision.Grid;

            foreach (var position in grid.Size().Range())
            {
                if (!vision.Visibility.GetAt(position))
                {
                    BuildingManipulator.HideBuilding(position);
                    continue;
                }

                if (grid.GetAt(position) == null)
                {
                    continue;
                }

                BuildingManipulator.SetBuilding(grid.GetAt(position), position);
            }
        }