示例#1
0
        private void Update()
        {
            if (Input.GetMouseButtonDown(0))
            {
                _path = DungeonGenerator.Instance.CurrentDungeon.Astar.GetPath(
                    DungeonGenerator.Instance.CurrentDungeon.Tilemap.WorldToCell(transform.position),
                    DungeonGenerator.Instance.CurrentDungeon.Tilemap.WorldToCell(
                        Camera.main.ScreenToWorldPoint(Input.mousePosition)));
            }

            if (_path == null || _path.Completed)
            {
                return;
            }

            SetFieldOfView(DungeonGenerator.Instance.CurrentDungeon.Tilemap.WorldToCell(transform.position),
                           FieldOfView, false);

            transform.position = _path.GetNextPoint();

            SetFieldOfView(DungeonGenerator.Instance.CurrentDungeon.Tilemap.WorldToCell(transform.position),
                           FieldOfView, true);
        }