private void Update()
    {
        if (moveEnabled && Input.GetMouseButton(0))
        {
            var v3 = Input.mousePosition;
            v3 = _referenceCamera.ScreenToWorldPoint(v3);
            transform.position = v3;
        }

        _vision.player      = _visionSystem._activePlayers;
        _vision.groundLevel = _visionSystem.GetGroundLevel(transform.position);
    }
Example #2
0
    private IEnumerator UpdateVision()
    {
        while (true)
        {
            _visionSystem.ClearVision();

            var visions = FindObjectsOfType <Vision>();
            visions.ToList().ForEach(v =>
            {
                v.groundLevel = _visionSystem.GetGroundLevel(v.transform.position);
                _visionSystem.UpdateVision(new VisionData
                {
                    position    = v.transform.position,
                    player      = v.player,
                    groundLevel = (short)v.groundLevel,
                    range       = v.range
                });
            });
            // update for all visions

            _visionSystem.UpdateTextures();
            yield return(new WaitForFixedUpdate());
        }
    }