示例#1
0
        private void OnNewMode(MouseMode mode)
        {
            highlightedUiTilemap.ClearAllTiles();
            uiTilemap.ClearAllTiles();

            switch (mode)
            {
            case MouseMode.RangedWeaponMode:
            {
                var effectedNodes = _ranged.FindAllPossibleEffectedNodes(_player.Occupant, grid.Value);

                foreach (var n in effectedNodes)
                {
                    var pos = grid.Value.Position00.ToVector2Int() + n.Position;
                    uiTilemap.SetTile((Vector3Int)pos, highlighted);
                }

                var targets = _ranged.FindAllPossibleTargets(_player.Occupant, grid.Value);
                foreach (var n in targets)
                {
                    var pos = grid.Value.Position00.ToVector2Int() + n.Position;
                    uiTilemap.SetTile((Vector3Int)pos, attackTile);
                }

                break;
            }

            case MouseMode.Moving:
            {
                var targets = _melee?.FindAllPossibleTargets(_player.Occupant, grid.Value);
                if (targets != null)
                {
                    foreach (var target in targets)
                    {
                        var pos = grid.Value.Position00.ToVector2Int() + target.Position;
                        uiTilemap.SetTile((Vector3Int)pos, attackTile);
                    }
                }

                break;
            }

            case MouseMode.OtherWeapon:
            {
                var effectedNodes = _item.FindAllPossibleEffectedNodes(_player.Occupant, grid.Value);

                foreach (var n in effectedNodes)
                {
                    var pos = grid.Value.Position00.ToVector2Int() + n.Position;
                    uiTilemap.SetTile((Vector3Int)pos, highlighted);
                }

                var targets = _item.FindAllPossibleTargets(_player.Occupant, grid.Value);
                foreach (var n in targets)
                {
                    var pos = grid.Value.Position00.ToVector2Int() + n.Position;
                    uiTilemap.SetTile((Vector3Int)pos, attackTile);
                }

                break;
            }
            }
        }