public bool CheckVisibilityUnderCursor()
        {
            Vector2Int cell       = _mouseCell;
            VisionMask visionMask = _visionController.GetMask(cell.x, cell.y);

            if (visionMask == null)
            {
                return(true);
            }
            return(visionMask.IsVisible());
        }
Esempio n. 2
0
        // Must be invoked before any TileObject's UpdateControllers
        private void Update()
        {
            if (!WasLoaded)
            {
                //Debug.LogError("Update on WalkController invoked before OnGameLoaded()");
                return;
            }

            if (_displayWalkBlockers)
            {
                if (_visionController == null)
                {
                    _visionController = FindObjectOfType <VisionController>();
                }

                for (int x = 0; x < ServerController.MapSize.x; x++)
                {
                    for (int y = 0; y < ServerController.MapSize.y; y++)
                    {
                        Color color      = Color.red;
                        float brightness = 1;
                        if (_walkBlockerCount[x, y] <= 0)
                        {
                            brightness = 1;
                        }
                        if (_walkBlockerCount[x, y] == 1)
                        {
                            brightness = 0.9f;
                        }
                        if (_walkBlockerCount[x, y] > 1)
                        {
                            brightness = 0.2f;
                        }
                        _visionController.GetMask(x, y)?.SetLighting(brightness, color);
                    }
                }
            }

            for (int i = 0; i < _walkBlockerCount.GetLength(0); i++)
            {
                for (int j = 0; j < _walkBlockerCount.GetLength(1); j++)
                {
                    _walkBlockerCount[i, j] = 0;
                }
            }
        }