示例#1
0
        private void Start()
        {
            _controlledMob = GetComponent <Mob>();

            if (!Spawned)
            {
                _controlledMob.enabled = false;
            }

            Assets.Scripts.Controllers.VisionController vc = _controlledMob.GetVisionController();

            Debug.LogWarning("Setting player's position...");
            vc.SetViewerPosition(_controlledMob);
        }
示例#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;
                }
            }
        }
        public override void OnGameLoaded(IServerDataProvider controller)
        {
            WasLoaded = true;

            _visionController = FindObjectOfType <VisionController>();

            if (_visionController == null)
            {
                Debug.LogError("VisionController not found!");
                Debug.Break();
            }

            _grid = FindObjectOfType <Grid>();
            _currentController = this;

            /*FindLocalPlayer();
             *
             * _visionController.SetViewerPosition(_localPlayerMob);*/
        }
示例#4
0
 private void EnsureControllers()
 {
     if (VisionController == null)
     {
         VisionController = FindObjectOfType <VisionController>();
     }
     if (ServerController == null)
     {
         ServerController = FindObjectOfType <ServerController>();
     }
     if (WalkController == null)
     {
         WalkController = FindObjectOfType <WalkController>();
     }
     if (AtmosController == null)
     {
         AtmosController = FindObjectOfType <AtmosController>();
     }
 }