Ejemplo n.º 1
0
        void Update()
        {
            FogOfWar fow = FogOfWar.GetFogOfWarTeam(team);

            if (fow == null)
            {
                Debug.LogWarning("There is no Fog Of War team for team #" + team.ToString());
                return;
            }

            bool visible = fow.GetFogValue(_transform.position) < minFogStrength;

            if (_renderer != null)
            {
                _renderer.enabled = visible;
            }
            if (_graphic != null)
            {
                _graphic.enabled = visible;
            }
            if (_canvas != null)
            {
                _canvas.enabled = visible;
            }
        }
Ejemplo n.º 2
0
        void Update()
        {
            bool visible = !FogOfWar.GetFogOfWarTeam(team).IsInFog(_transform.position, minFogStrength);

            if (_renderer != null)
            {
                _renderer.enabled = visible;
            }
            if (_graphic != null)
            {
                _graphic.enabled = visible;
            }
            if (_canvas != null)
            {
                _canvas.enabled = visible;
            }
        }
        void Update()
        {
            if (_isInFog == FogOfWar.GetFogOfWarTeam(team).IsInFog(_transform.position, minFogStrength))
            {
                return;
            }

            _isInFog = !_isInFog;

            if (_isInFog)
            {
                onFogEnter.Invoke();
            }
            else
            {
                onFogExit.Invoke();
            }
        }
        void Update()
        {
            _transform.position = Vector2.MoveTowards(_transform.position, _targetPosition, Time.deltaTime * movementSpeed);
            if (cameraTransform != null)
            {
                cameraTransform.position = _transform.position + Vector3.back * 10;
            }

            if (Input.GetKeyDown(KeyCode.Space))
            {
                FogOfWar.GetFogOfWarTeam(0).SetAll(255);
            }

            if (Vector2.Distance(_transform.position, _targetPosition) < 0.01f)
            {
                Vector2 dir = Vector2.zero;
                if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.UpArrow))
                {
                    ++dir.y;
                }
                else if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow))
                {
                    ++dir.x;
                }
                else if (Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.DownArrow))
                {
                    --dir.y;
                }
                else if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow))
                {
                    --dir.x;
                }

                if (dir.sqrMagnitude > 0.1f)
                {
                    RaycastHit2D hit = Physics2D.Raycast(_targetPosition, dir, 1);
                    if (hit.collider == null)
                    {
                        _targetPosition += dir;
                    }
                }
            }
        }
Ejemplo n.º 5
0
        void Update()
        {
            bool isinfog = FogOfWar.GetFogOfWarTeam(team).GetFogValue(_transform.position) < (byte)(minFogStrength * 255);

            if (_isInFog == isinfog)
            {
                return;
            }

            _isInFog = !_isInFog;

            if (_isInFog)
            {
                onFogEnter.Invoke();
            }
            else
            {
                onFogExit.Invoke();
            }
        }
Ejemplo n.º 6
0
 void OnRenderImage(RenderTexture source, RenderTexture destination)
 {
     FogOfWar.GetFogOfWarTeam(team).RenderFog(source, destination, _camera);
 }