From 4c6a840b3943e46006eff36df6035418bb721713 Mon Sep 17 00:00:00 2001 From: chendian <-> Date: Wed, 5 Feb 2025 11:42:33 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=85=B3=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scene/level/level.tscn | 6 +- script/_global/util.gd | 7 +++ script/level/level.gd | 5 +- script/level/level_instance.gd | 96 ++++++++++++++++++++++++----- script/manager/level_manager.gd | 24 ++++++-- script/ui/hud/player_status_item.gd | 8 ++- 6 files changed, 120 insertions(+), 26 deletions(-) diff --git a/scene/level/level.tscn b/scene/level/level.tscn index e7d85a0..13ebc9c 100644 --- a/scene/level/level.tscn +++ b/scene/level/level.tscn @@ -24,11 +24,11 @@ mesh_library = ExtResource("1_am8tr") cell_size = Vector3(1.28, 1.28, 1.28) cell_center_y = false data = { -"cells": PackedInt32Array(196608, 4, 2, 24, 4, 655362, 55, 4, 1441794, 31, 4, 1048578, 27, 4, 655362, 7, 4, 2, 131072, 4, 2, 60, 4, 1441794, 8, 4, 2, 58, 4, 1441794, 65568, 4, 655362, 67, 4, 1441794, 62, 4, 1441794, 23, 4, 655362, 262152, 4, 1441794, 51, 4, 1441794, 65536, 4, 2, 22, 4, 655362, 65567, 4, 655362, 36, 4, 1048578, 0, 4, 2, 30, 4, 655362, 56, 4, 1441794, 1, 4, 2, 29, 4, 655362, 69, 4, 1441794, 2, 4, 2, 70, 4, 1441794, 6, 4, 2, 68, 4, 1441794, 28, 4, 655362, 66, 4, 1441794, 262156, 4, 1441794, 5, 4, 2, 9, 4, 2, 13, 4, 2, 33, 4, 1048578, 262155, 4, 1441794, 10, 4, 2, 63, 4, 1441794, 32, 4, 1048578, 54, 4, 1441794, 65, 4, 1441794, 4, 4, 2, 11, 4, 2, 3, 4, 2, 15, 4, 2, 25, 4, 655362, 196616, 4, 1441794, 12, 4, 2, 64, 4, 1441794, 262153, 4, 1441794, 34, 4, 1048578, 59, 4, 1441794, 53, 4, 1441794, 262184, 4, 1441794, 65560, 4, 655364, 35, 4, 1048578, 52, 4, 1441794, 14, 4, 2, 65559, 4, 655365, 48, 4, 2, 49, 4, 2, 196648, 4, 1441794, 47, 4, 2, 41, 4, 2, 46, 4, 2, 61, 4, 1441794, 42, 4, 2, 45, 4, 2, 43, 4, 2, 44, 4, 2, 40, 4, 2, 50, 4, 2, 39, 4, 1048578, 65558, 4, 1048578, 37, 4, 1048578, 196620, 4, 1441794, 26, 4, 655362, 262144, 4, 2, 57, 4, 1441794, 196619, 4, 1441794, 196618, 4, 1441794, 262154, 4, 1441794, 38, 4, 1048578, 196617, 4, 1441794, 65563, 3, 655362, 65568, 3, 655362, 19, 3, 2, 70, 3, 1441794, 65583, 3, 655365, 62, 3, 1441794, 65546, 3, 2, 65578, 3, 4, 65582, 3, 2, 65554, 3, 1441795, 65552, 3, 2, 65547, 3, 2, 65548, 3, 2, 61, 3, 1441794, 18, 3, 655362, 65545, 3, 2, 65551, 3, 5, 65572, 3, 1441794, 20, 3, 2, 65567, 3, 655362, 65581, 3, 2, 17, 3, 2, 65573, 3, 655362, 60, 3, 1441794, 65556, 3, 2, 3, 3, 2, 59, 3, 1441794, 12, 3, 2, 4, 3, 2, 65574, 3, 655362, 65576, 3, 655362, 65536, 3, 2, 65558, 3, 655362, 65586, 3, 2, 65560, 3, 1048578, 65555, 3, 2, 65553, 3, 1441795, 65584, 3, 655364, 21, 3, 655362, 63, 3, 1441794, 64, 3, 1441794, 65579, 3, 5, 65559, 3, 655362, 13, 3, 2, 15, 3, 2, 65544, 3, 2, 16, 3, 2, 5, 3, 2, 65580, 3, 2, 65557, 3, 655362, 14, 3, 2, 65550, 3, 4, 65575, 3, 655362, 68, 3, 1441794, 23, 3, 655362, 22, 3, 655362, 262184, 3, 655362, 27, 3, 655362, 26, 3, 655362, 262144, 3, 2, 57, 3, 1441794, 25, 3, 655362, 262152, 3, 2, 41, 3, 2, 262154, 3, 2, 262153, 3, 2, 48, 3, 2, 262194, 3, 2, 49, 3, 2, 40, 3, 2, 39, 3, 1048578, 50, 3, 2, 44, 3, 2, 43, 3, 2, 42, 3, 2, 45, 3, 2, 46, 3, 2, 47, 3, 2, 35, 3, 1048578, 196648, 3, 655362, 196658, 3, 2, 52, 3, 1441794, 34, 3, 1048578, 30, 3, 655362, 55, 3, 1441794, 29, 3, 655362, 327730, 3, 2, 262158, 3, 1441794, 28, 3, 655362, 262157, 3, 1441794, 56, 3, 1441794, 262156, 3, 2, 262155, 3, 2, 33, 3, 1048578, 32, 3, 1048578, 262163, 3, 1441794, 262164, 3, 1441794, 262168, 3, 1441794, 54, 3, 1441794, 262165, 3, 1441794, 262167, 3, 1441794, 262166, 3, 1441794, 31, 3, 1048578, 262159, 3, 1441794, 24, 3, 655362, 262160, 3, 1441794, 58, 3, 1441794, 262161, 3, 1441794, 262162, 3, 1441794, 37, 3, 1048578, 51, 3, 1441794, 196608, 3, 2, 36, 3, 1048578, 131083, 3, 2, 67, 3, 1441794, 8, 3, 2, 131084, 3, 2, 131072, 3, 2, 7, 3, 2, 6, 3, 2, 11, 3, 2, 65, 3, 1441794, 10, 3, 2, 131112, 3, 655362, 131082, 3, 2, 9, 3, 2, 131081, 3, 2, 131122, 3, 2, 131080, 3, 2, 66, 3, 1441794, 2, 3, 2, 69, 3, 1441794, 1, 3, 2, 0, 3, 2, 196617, 3, 2, 196616, 3, 2, 38, 3, 1048578, 196618, 3, 2, 196620, 3, 1441794, 196619, 3, 2, 53, 3, 1441794, 31, 2, 2, 46, 2, 2, 65, 2, 1441794, 18, 2, 2, 10, 2, 2, 11, 2, 2, 54, 2, 1441794, 21, 2, 2, 35, 2, 2, 5, 2, 2, 32, 2, 2, 42, 2, 2, 13, 2, 2, 9, 2, 2, 55, 2, 1441794, 30, 2, 2, 65581, 2, 2, 0, 2, 2, 1, 2, 2, 34, 2, 2, 52, 2, 1441794, 29, 2, 2, 53, 2, 1441794, 65582, 2, 2, 2, 2, 2, 66, 2, 1441794, 38, 2, 2, 56, 2, 1441794, 28, 2, 2, 70, 2, 1441794, 65583, 2, 2, 68, 2, 1441794, 33, 2, 2, 19, 2, 2, 62, 2, 1441794, 17, 2, 2, 41, 2, 2, 43, 2, 2, 47, 2, 2, 64, 2, 1441794, 20, 2, 2, 63, 2, 1441794, 16, 2, 2, 59, 2, 1441794, 48, 2, 2, 36, 2, 2, 37, 2, 2, 44, 2, 2, 49, 2, 2, 50, 2, 2, 40, 2, 2, 39, 2, 2, 51, 2, 1441794, 60, 2, 1441794, 4, 2, 2, 24, 2, 2, 6, 2, 2, 3, 2, 2, 14, 2, 2, 45, 2, 2, 58, 2, 1441794, 23, 2, 2, 7, 2, 2, 22, 2, 2, 69, 2, 1441794, 15, 2, 2, 27, 2, 2, 26, 2, 2, 8, 2, 2, 61, 2, 1441794, 67, 2, 1441794, 57, 2, 1441794, 25, 2, 2, 12, 2, 2, 65541, 2, 2, 196649, 2, 2, 65537, 2, 2, 262187, 2, 2, 65555, 2, 2, 196637, 2, 655362, 131108, 2, 655362, 65557, 2, 655362, 65563, 2, 655362, 196638, 2, 655362, 65578, 2, 2, 262193, 2, 2, 262153, 2, 2, 131096, 2, 655362, 262194, 2, 2, 262152, 2, 2, 131087, 2, 2, 131106, 2, 655362, 262154, 2, 2, 196650, 2, 2, 131095, 2, 655362, 131080, 2, 2, 65559, 2, 655362, 65536, 2, 2, 65562, 2, 655362, 262146, 2, 2, 196613, 2, 2, 65538, 2, 2, 65540, 2, 2, 65558, 2, 655362, 65539, 2, 2, 65561, 2, 655362, 65556, 2, 2, 262145, 2, 2, 65577, 2, 2, 65580, 2, 2, 262186, 2, 2, 65564, 2, 655362, 262144, 2, 2, 65554, 2, 2, 65560, 2, 655362, 65542, 2, 2, 65579, 2, 2, 196612, 2, 2, 196651, 2, 2, 196631, 2, 655362, 131092, 2, 2, 131097, 2, 655362, 131078, 2, 2, 131088, 2, 2, 131104, 2, 655362, 196657, 2, 2, 131093, 2, 655362, 131105, 2, 655362, 131121, 2, 2, 131074, 2, 2, 131120, 2, 2, 131122, 2, 2, 131119, 2, 2, 131114, 2, 2, 131081, 2, 2, 196648, 2, 1048578, 131073, 2, 2, 131077, 2, 2, 131113, 2, 2, 131076, 2, 2, 196635, 2, 655362, 131094, 2, 655362, 196655, 2, 2, 196658, 2, 2, 131086, 2, 2, 196656, 2, 2, 131107, 2, 655362, 131100, 2, 655362, 196636, 2, 655362, 131112, 2, 1048578, 131101, 2, 655362, 131090, 2, 2, 131102, 2, 655362, 131099, 2, 655362, 196634, 2, 655362, 196633, 2, 655362, 131089, 2, 2, 131079, 2, 2, 131075, 2, 2, 131103, 2, 655362, 131091, 2, 2, 131098, 2, 655362, 196632, 2, 655362, 131115, 2, 2, 262171, 2, 1048578, 262163, 2, 1048578, 65546, 2, 2, 262170, 2, 1048578, 131085, 2, 2, 262169, 2, 1048578, 262164, 2, 1048578, 65552, 2, 2, 262168, 2, 1048578, 65575, 2, 655362, 262165, 2, 1048578, 262167, 2, 1048578, 65545, 2, 2, 65576, 2, 2, 262166, 2, 1048578, 65567, 2, 655362, 262159, 2, 1048578, 196619, 2, 1441794, 65553, 2, 2, 262160, 2, 1048578, 196618, 2, 2, 65566, 2, 655362, 196622, 2, 2, 196609, 2, 2, 196629, 2, 655362, 196610, 2, 2, 196628, 2, 2, 196621, 2, 2, 196611, 2, 2, 327730, 2, 2, 196608, 2, 2, 196630, 2, 655362, 196623, 2, 2, 65584, 2, 2, 262158, 2, 1048578, 196620, 2, 2, 65585, 2, 2, 262157, 2, 1048578, 131082, 2, 2, 262156, 2, 1048578, 262155, 2, 1441794, 65586, 2, 2, 65551, 2, 2, 65573, 2, 655362, 262151, 2, 2, 262150, 2, 2, 196625, 2, 2, 65570, 2, 655362, 262184, 2, 1048578, 196616, 2, 2, 196615, 2, 2, 262149, 2, 2, 196626, 2, 2, 262148, 2, 2, 131084, 2, 2, 65574, 2, 655362, 196614, 2, 2, 65548, 2, 2, 65569, 2, 655362, 65547, 2, 1441794, 262147, 2, 2, 196627, 2, 2, 65568, 2, 655362, 262185, 2, 2, 262191, 2, 2, 131083, 2, 1441794, 65565, 2, 655362, 65544, 2, 2, 196617, 2, 2, 196624, 2, 2, 65543, 2, 2, 65549, 2, 2, 131072, 2, 2, 65571, 2, 655362, 262161, 2, 1048578, 65550, 2, 2, 65572, 2, 655362, 262192, 2, 2, 262162, 2, 1048578, 262174, 2, 1048578, 262173, 2, 1048578, 262172, 2, 1048578, 34, 1, 2, 196639, 1, 655362, 196655, 1, 2, 52, 1, 1441794, 196640, 1, 655362, 196641, 1, 655362, 53, 1, 1441794, 37, 1, 2, 196658, 1, 2, 196649, 1, 2, 36, 1, 2, 35, 1, 2, 41, 1, 2, 38, 1, 2, 196638, 1, 655362, 262186, 1, 2, 262185, 1, 2, 27, 1, 2, 262191, 1, 2, 59, 1, 1441794, 262184, 1, 1048578, 22, 1, 2, 262192, 1, 2, 23, 1, 2, 262174, 1, 655362, 262175, 1, 655362, 262176, 1, 655362, 262177, 1, 655362, 24, 1, 2, 262178, 1, 655362, 54, 1, 1441794, 32, 1, 2, 33, 1, 2, 56, 1, 1441794, 262179, 1, 655362, 28, 1, 2, 327730, 1, 2, 29, 1, 2, 55, 1, 1441794, 30, 1, 2, 31, 1, 2, 196642, 1, 655362, 196656, 1, 2, 196643, 1, 655362, 46, 1, 2, 42, 1, 2, 196648, 1, 1048578, 196657, 1, 2, 45, 1, 2, 196652, 1, 2, 43, 1, 2, 44, 1, 2, 50, 1, 2, 196653, 1, 2, 196651, 1, 2, 39, 1, 2, 196654, 1, 2, 40, 1, 2, 49, 1, 2, 196650, 1, 2, 48, 1, 2, 47, 1, 2, 58, 1, 1441794, 262193, 1, 2, 25, 1, 2, 262194, 1, 2, 262188, 1, 2, 57, 1, 1441794, 262189, 1, 2, 26, 1, 2, 262187, 1, 2, 262190, 1, 2, 64, 1, 1441794, 5, 1, 2, 65566, 1, 655362, 70, 1, 1441794, 131102, 1, 655362, 0, 1, 2, 65576, 1, 655362, 11, 1, 2, 65567, 1, 655362, 21, 1, 2, 65575, 1, 655362, 14, 1, 2, 131103, 1, 655362, 1, 1, 2, 65574, 1, 1048578, 131104, 1, 655362, 131121, 1, 2, 66, 1, 1441794, 131122, 1, 2, 131114, 1, 2, 131118, 1, 2, 65586, 1, 2, 13, 1, 2, 9, 1, 2, 131120, 1, 2, 131119, 1, 2, 19, 1, 2, 61, 1, 1441794, 65568, 1, 655362, 18, 1, 2, 15, 1, 2, 65569, 1, 655362, 65577, 1, 2, 17, 1, 2, 20, 1, 2, 16, 1, 2, 65578, 1, 2, 65579, 1, 2, 62, 1, 1441794, 65570, 1, 655362, 2, 1, 2, 69, 1, 1441794, 131106, 1, 655362, 60, 1, 1441794, 3, 1, 2, 65573, 1, 655362, 65572, 1, 655362, 131105, 1, 655362, 4, 1, 2, 65571, 1, 655362, 63, 1, 1441794, 131107, 1, 655362, 131116, 1, 2, 6, 1, 2, 131109, 1, 655365, 8, 1, 2, 67, 1, 1441794, 131117, 1, 2, 65583, 1, 2, 68, 1, 1441794, 65580, 1, 2, 131115, 1, 2, 65584, 1, 2, 131113, 1, 2, 65585, 1, 2, 131112, 1, 1048578, 131108, 1, 655362, 65581, 1, 2, 51, 1, 1441794, 65582, 1, 2, 65, 1, 1441794, 7, 1, 2, 12, 1, 2, 131110, 1, 655364, 10, 1, 2, 65590, 0, 2, 65571, 0, 655362, 29, 0, 2, 65589, 0, 2, 262205, 0, 2, 12, 0, 2, 65573, 0, 655362, 65572, 0, 655362, 23, 0, 2, 65587, 0, 2, 61, 0, 1441794, 30, 0, 2, 65592, 0, 2, 262184, 0, 1048578, 65588, 0, 2, 60, 0, 1441794, 55, 0, 1441794, 65599, 0, 2, 59, 0, 1441794, 22, 0, 2, 65591, 0, 2, 17, 0, 2, 65595, 0, 2, 65574, 0, 655362, 262202, 0, 2, 14, 0, 2, 262204, 0, 2, 65575, 0, 1048578, 54, 0, 1441794, 262196, 0, 2, 65598, 0, 2, 262201, 0, 2, 65593, 0, 2, 33, 0, 2, 32, 0, 2, 65586, 0, 2, 262200, 0, 2, 262208, 0, 2, 262207, 0, 2, 65597, 0, 2, 262195, 0, 2, 262180, 0, 655362, 262181, 0, 655362, 63, 0, 1441794, 262199, 0, 2, 65600, 0, 2, 64, 0, 1441794, 24, 0, 2, 262206, 0, 2, 65594, 0, 2, 262198, 0, 2, 65576, 0, 1048578, 65596, 0, 2, 11, 0, 2, 327730, 0, 2, 262197, 0, 2, 31, 0, 2, 21, 0, 2, 262203, 0, 2, 28, 0, 2, 13, 0, 2, 262179, 0, 655362, 52, 0, 1441794, 68, 0, 1441794, 196645, 0, 655362, 35, 0, 2, 131112, 0, 1048578, 196663, 0, 2, 36, 0, 2, 10, 0, 2, 196659, 0, 2, 65, 0, 1441794, 196662, 0, 2, 196644, 0, 655362, 41, 0, 2, 9, 0, 2, 196643, 0, 655362, 131111, 0, 1048578, 131122, 0, 2, 46, 0, 2, 42, 0, 2, 196661, 0, 2, 196660, 0, 2, 196648, 0, 1048578, 45, 0, 2, 196671, 0, 2, 196667, 0, 2, 37, 0, 2, 51, 0, 1441794, 196668, 0, 2, 66, 0, 1441794, 196672, 0, 2, 131136, 0, 2, 196670, 0, 2, 196669, 0, 2, 67, 0, 1441794, 8, 0, 2, 38, 0, 2, 131108, 0, 655362, 131124, 0, 2, 131123, 0, 2, 34, 0, 2, 7, 0, 2, 131110, 0, 655362, 53, 0, 1441794, 131109, 0, 655362, 196646, 0, 655362, 131135, 0, 2, 6, 0, 2, 4, 0, 2, 131107, 0, 655362, 131134, 0, 2, 262182, 0, 655362, 47, 0, 2, 131130, 0, 2, 3, 0, 2, 58, 0, 1441794, 69, 0, 1441794, 262183, 0, 1048578, 262194, 0, 2, 25, 0, 2, 2, 0, 2, 57, 0, 1441794, 16, 0, 2, 62, 0, 1441794, 20, 0, 2, 26, 0, 2, 15, 0, 2, 18, 0, 2, 19, 0, 2, 27, 0, 2, 56, 0, 1441794, 43, 0, 2, 131129, 0, 2, 196647, 0, 1048578, 131126, 0, 2, 44, 0, 2, 1, 0, 2, 131127, 0, 2, 196666, 0, 2, 50, 0, 2, 131133, 0, 2, 196658, 0, 2, 0, 0, 2, 131132, 0, 2, 39, 0, 2, 70, 0, 1441794, 131128, 0, 2, 40, 0, 2, 5, 0, 2, 196664, 0, 2, 49, 0, 2, 131131, 0, 2, 131125, 0, 2, 196665, 0, 2, 48, 0, 2, 393266, 0, 2, 393266, 1, 2, 393266, 2, 2, 393266, 3, 2, 262195, 1, 2, 262195, 2, 2, 262195, 3, 2, 262196, 1, 2, 262196, 2, 2, 262196, 3, 2, 262197, 1, 2, 262197, 2, 2, 262197, 3, 2, 262198, 1, 2, 262198, 2, 2, 262198, 3, 2, 458802, 0, 2, 458802, 1, 2, 458802, 2, 2, 458802, 3, 2, 524338, 0, 2, 524338, 1, 2, 524338, 2, 2, 524338, 3, 2, 589874, 0, 2, 589874, 1, 2, 589874, 2, 2, 589874, 3, 2, 524339, 0, 2, 524339, 1, 2, 524339, 2, 2, 524340, 0, 2, 524340, 1, 2, 524340, 2, 2) +"cells": PackedInt32Array(196608, 4, 2, 24, 4, 655362, 55, 4, 1441794, 31, 4, 1048578, 27, 4, 655362, 7, 4, 2, 131072, 4, 2, 60, 4, 1441794, 8, 4, 2, 58, 4, 1441794, 65568, 4, 655362, 67, 4, 1441794, 62, 4, 1441794, 23, 4, 655362, 262152, 4, 1441794, 51, 4, 1441794, 65536, 4, 2, 22, 4, 655362, 65567, 4, 655362, 36, 4, 1048578, 0, 4, 2, 30, 4, 655362, 56, 4, 1441794, 1, 4, 2, 29, 4, 655362, 69, 4, 1441794, 2, 4, 2, 70, 4, 1441794, 6, 4, 2, 68, 4, 1441794, 28, 4, 655362, 66, 4, 1441794, 262156, 4, 1441794, 5, 4, 2, 9, 4, 2, 13, 4, 2, 33, 4, 1048578, 262155, 4, 1441794, 10, 4, 2, 63, 4, 1441794, 32, 4, 1048578, 54, 4, 1441794, 65, 4, 1441794, 4, 4, 2, 11, 4, 2, 3, 4, 2, 15, 4, 2, 25, 4, 655362, 196616, 4, 1441794, 12, 4, 2, 64, 4, 1441794, 262153, 4, 1441794, 34, 4, 1048578, 59, 4, 1441794, 53, 4, 1441794, 262184, 4, 1441794, 65560, 4, 655364, 35, 4, 1048578, 52, 4, 1441794, 14, 4, 2, 65559, 4, 655365, 48, 4, 2, 49, 4, 2, 196648, 4, 1441794, 47, 4, 2, 41, 4, 2, 46, 4, 2, 61, 4, 1441794, 42, 4, 2, 45, 4, 2, 43, 4, 2, 44, 4, 2, 40, 4, 2, 50, 4, 2, 39, 4, 1048578, 65558, 4, 1048578, 37, 4, 1048578, 196620, 4, 1441794, 26, 4, 655362, 262144, 4, 2, 57, 4, 1441794, 196619, 4, 1441794, 196618, 4, 1441794, 262154, 4, 1441794, 38, 4, 1048578, 196617, 4, 1441794, 65563, 3, 655362, 65568, 3, 655362, 19, 3, 2, 70, 3, 1441794, 65583, 3, 655365, 62, 3, 1441794, 65546, 3, 2, 65578, 3, 4, 65582, 3, 2, 65554, 3, 1441795, 65552, 3, 1441795, 65547, 3, 2, 65548, 3, 2, 61, 3, 1441794, 18, 3, 655362, 65545, 3, 2, 65572, 3, 1441794, 20, 3, 2, 65567, 3, 655362, 65581, 3, 2, 17, 3, 2, 65573, 3, 655362, 60, 3, 1441794, 65556, 3, 2, 3, 3, 2, 59, 3, 1441794, 12, 3, 2, 4, 3, 2, 65574, 3, 655362, 65576, 3, 655362, 65536, 3, 2, 65558, 3, 655362, 65586, 3, 2, 65560, 3, 1048578, 65555, 3, 2, 65553, 3, 1441795, 65584, 3, 655364, 21, 3, 1441794, 63, 3, 1441794, 64, 3, 1441794, 65579, 3, 5, 65559, 3, 655362, 13, 3, 2, 15, 3, 2, 65544, 3, 2, 16, 3, 2, 5, 3, 2, 65580, 3, 2, 65557, 3, 655362, 14, 3, 2, 65575, 3, 655362, 68, 3, 1441794, 23, 3, 655362, 22, 3, 655362, 262184, 3, 655362, 27, 3, 655362, 26, 3, 655362, 262144, 3, 2, 57, 3, 1441794, 25, 3, 655362, 262152, 3, 2, 41, 3, 2, 262154, 3, 2, 262153, 3, 2, 48, 3, 2, 262194, 3, 2, 49, 3, 2, 40, 3, 2, 39, 3, 1048578, 50, 3, 2, 44, 3, 2, 43, 3, 2, 42, 3, 2, 45, 3, 2, 46, 3, 2, 47, 3, 2, 35, 3, 1048578, 196648, 3, 655362, 196658, 3, 2, 52, 3, 1441794, 34, 3, 1048578, 30, 3, 655362, 55, 3, 1441794, 29, 3, 655362, 327730, 3, 2, 262158, 3, 1441794, 28, 3, 655362, 262157, 3, 1441794, 56, 3, 1441794, 262156, 3, 2, 262155, 3, 2, 33, 3, 1048578, 32, 3, 1048578, 262163, 3, 1441794, 262164, 3, 1441794, 262168, 3, 1441794, 54, 3, 1441794, 262165, 3, 1441794, 262167, 3, 1441794, 262166, 3, 1441794, 31, 3, 1048578, 262159, 3, 1441794, 24, 3, 655362, 262160, 3, 1441794, 58, 3, 1441794, 262161, 3, 1441794, 262162, 3, 1441794, 37, 3, 1048578, 51, 3, 1441794, 196608, 3, 2, 36, 3, 1048578, 131083, 3, 2, 67, 3, 1441794, 8, 3, 2, 131084, 3, 2, 131072, 3, 2, 7, 3, 2, 6, 3, 2, 11, 3, 2, 65, 3, 1441794, 10, 3, 2, 131112, 3, 655362, 131082, 3, 2, 9, 3, 2, 131081, 3, 2, 131122, 3, 2, 131080, 3, 2, 66, 3, 1441794, 2, 3, 2, 69, 3, 1441794, 1, 3, 2, 0, 3, 2, 196617, 3, 2, 196616, 3, 2, 38, 3, 1048578, 196618, 3, 2, 196620, 3, 1441794, 196619, 3, 2, 53, 3, 1441794, 31, 2, 2, 46, 2, 2, 65, 2, 1441794, 18, 2, 2, 10, 2, 2, 11, 2, 2, 54, 2, 1441794, 21, 2, 2, 35, 2, 2, 5, 2, 2, 32, 2, 2, 42, 2, 2, 13, 2, 2, 9, 2, 2, 55, 2, 1441794, 30, 2, 2, 65581, 2, 2, 0, 2, 2, 1, 2, 2, 34, 2, 2, 52, 2, 1441794, 29, 2, 2, 53, 2, 1441794, 65582, 2, 2, 2, 2, 2, 66, 2, 1441794, 38, 2, 2, 56, 2, 1441794, 28, 2, 2, 70, 2, 1441794, 65583, 2, 2, 68, 2, 1441794, 33, 2, 2, 19, 2, 2, 62, 2, 1441794, 17, 2, 2, 41, 2, 2, 43, 2, 2, 47, 2, 2, 64, 2, 1441794, 20, 2, 2, 63, 2, 1441794, 16, 2, 2, 59, 2, 1441794, 48, 2, 2, 36, 2, 2, 37, 2, 2, 44, 2, 2, 49, 2, 2, 50, 2, 2, 40, 2, 2, 39, 2, 2, 51, 2, 1441794, 60, 2, 1441794, 4, 2, 2, 24, 2, 2, 6, 2, 2, 3, 2, 2, 14, 2, 2, 45, 2, 2, 58, 2, 1441794, 23, 2, 2, 7, 2, 2, 22, 2, 2, 69, 2, 1441794, 15, 2, 2, 27, 2, 2, 26, 2, 2, 8, 2, 2, 61, 2, 1441794, 67, 2, 1441794, 57, 2, 1441794, 25, 2, 2, 12, 2, 2, 65541, 2, 2, 196649, 2, 2, 65537, 2, 2, 262187, 2, 2, 65555, 2, 2, 196637, 2, 655362, 131108, 2, 655362, 65557, 2, 655362, 65563, 2, 655362, 196638, 2, 655362, 65578, 2, 2, 262193, 2, 2, 262153, 2, 2, 131096, 2, 655362, 262194, 2, 2, 262152, 2, 2, 131087, 2, 2, 131106, 2, 655362, 262154, 2, 2, 196650, 2, 2, 131095, 2, 655362, 131080, 2, 2, 65559, 2, 655362, 65536, 2, 2, 65562, 2, 655362, 262146, 2, 2, 196613, 2, 2, 65538, 2, 2, 65540, 2, 2, 65558, 2, 655362, 65539, 2, 2, 65561, 2, 655362, 65556, 2, 2, 262145, 2, 2, 65577, 2, 2, 65580, 2, 2, 262186, 2, 2, 65564, 2, 655362, 262144, 2, 2, 65554, 2, 2, 65560, 2, 655362, 65542, 2, 2, 65579, 2, 2, 196612, 2, 2, 196651, 2, 2, 196631, 2, 655362, 131092, 2, 2, 131097, 2, 655362, 131078, 2, 2, 131088, 2, 2, 131104, 2, 655362, 196657, 2, 2, 131093, 2, 655362, 131105, 2, 655362, 131121, 2, 2, 131074, 2, 2, 131120, 2, 2, 131122, 2, 2, 131119, 2, 2, 131114, 2, 2, 131081, 2, 2, 196648, 2, 1048578, 131073, 2, 2, 131077, 2, 2, 131113, 2, 2, 131076, 2, 2, 196635, 2, 655362, 131094, 2, 655362, 196655, 2, 2, 196658, 2, 2, 131086, 2, 2, 196656, 2, 2, 131107, 2, 655362, 131100, 2, 655362, 196636, 2, 655362, 131112, 2, 1048578, 131101, 2, 655362, 131090, 2, 2, 131102, 2, 655362, 131099, 2, 655362, 196634, 2, 655362, 196633, 2, 655362, 131089, 2, 2, 131079, 2, 2, 131075, 2, 2, 131103, 2, 655362, 131091, 2, 2, 131098, 2, 655362, 196632, 2, 655362, 131115, 2, 2, 262171, 2, 1048578, 262163, 2, 1048578, 65546, 2, 2, 262170, 2, 1048578, 131085, 2, 2, 262169, 2, 1048578, 262164, 2, 1048578, 65552, 2, 2, 262168, 2, 1048578, 65575, 2, 655362, 262165, 2, 1048578, 262167, 2, 1048578, 65545, 2, 2, 65576, 2, 2, 262166, 2, 1048578, 65567, 2, 655362, 262159, 2, 1048578, 196619, 2, 1441794, 65553, 2, 2, 262160, 2, 1048578, 196618, 2, 2, 65566, 2, 655362, 196622, 2, 2, 196609, 2, 2, 196629, 2, 655362, 196610, 2, 2, 196628, 2, 2, 196621, 2, 2, 196611, 2, 2, 327730, 2, 2, 196608, 2, 2, 196630, 2, 655362, 196623, 2, 2, 65584, 2, 2, 262158, 2, 1048578, 196620, 2, 2, 65585, 2, 2, 262157, 2, 1048578, 131082, 2, 2, 262156, 2, 1048578, 262155, 2, 1441794, 65586, 2, 2, 65551, 2, 2, 65573, 2, 655362, 262151, 2, 2, 262150, 2, 2, 196625, 2, 2, 65570, 2, 655362, 262184, 2, 1048578, 196616, 2, 2, 196615, 2, 2, 262149, 2, 2, 196626, 2, 2, 262148, 2, 2, 131084, 2, 2, 65574, 2, 655362, 196614, 2, 2, 65548, 2, 2, 65569, 2, 655362, 65547, 2, 1441794, 262147, 2, 2, 196627, 2, 2, 65568, 2, 655362, 262185, 2, 2, 262191, 2, 2, 131083, 2, 1441794, 65565, 2, 655362, 65544, 2, 2, 196617, 2, 2, 196624, 2, 2, 65543, 2, 2, 65549, 2, 2, 131072, 2, 2, 65571, 2, 655362, 262161, 2, 1048578, 65550, 2, 2, 65572, 2, 655362, 262192, 2, 2, 262162, 2, 1048578, 262174, 2, 1048578, 262173, 2, 1048578, 262172, 2, 1048578, 34, 1, 2, 196639, 1, 655362, 196655, 1, 2, 52, 1, 1441794, 196640, 1, 655362, 196641, 1, 655362, 53, 1, 1441794, 37, 1, 2, 196658, 1, 2, 196649, 1, 2, 36, 1, 2, 35, 1, 2, 41, 1, 2, 38, 1, 2, 196638, 1, 655362, 262186, 1, 2, 262185, 1, 2, 27, 1, 2, 262191, 1, 2, 59, 1, 1441794, 262184, 1, 1048578, 22, 1, 2, 262192, 1, 2, 23, 1, 2, 262174, 1, 655362, 262175, 1, 655362, 262176, 1, 655362, 262177, 1, 655362, 24, 1, 2, 262178, 1, 655362, 54, 1, 1441794, 32, 1, 2, 33, 1, 2, 56, 1, 1441794, 262179, 1, 655362, 28, 1, 2, 327730, 1, 2, 29, 1, 2, 55, 1, 1441794, 30, 1, 2, 31, 1, 2, 196642, 1, 655362, 196656, 1, 2, 196643, 1, 655362, 46, 1, 2, 42, 1, 2, 196648, 1, 1048578, 196657, 1, 2, 45, 1, 2, 196652, 1, 2, 43, 1, 2, 44, 1, 2, 50, 1, 2, 196653, 1, 2, 196651, 1, 2, 39, 1, 2, 196654, 1, 2, 40, 1, 2, 49, 1, 2, 196650, 1, 2, 48, 1, 2, 47, 1, 2, 58, 1, 1441794, 262193, 1, 2, 25, 1, 2, 262194, 1, 2, 262188, 1, 2, 57, 1, 1441794, 262189, 1, 2, 26, 1, 2, 262187, 1, 2, 262190, 1, 2, 64, 1, 1441794, 5, 1, 2, 65566, 1, 655362, 70, 1, 1441794, 131102, 1, 655362, 0, 1, 2, 65576, 1, 655362, 11, 1, 2, 65567, 1, 655362, 21, 1, 2, 65575, 1, 655362, 14, 1, 2, 131103, 1, 655362, 1, 1, 2, 65574, 1, 1048578, 131104, 1, 655362, 131121, 1, 2, 66, 1, 1441794, 131122, 1, 2, 131114, 1, 2, 131118, 1, 2, 65586, 1, 2, 13, 1, 2, 9, 1, 2, 131120, 1, 2, 131119, 1, 2, 19, 1, 2, 61, 1, 1441794, 65568, 1, 655362, 18, 1, 2, 15, 1, 2, 65569, 1, 655362, 65577, 1, 2, 17, 1, 2, 20, 1, 2, 16, 1, 2, 65578, 1, 2, 65579, 1, 2, 62, 1, 1441794, 65570, 1, 655362, 2, 1, 2, 69, 1, 1441794, 131106, 1, 655362, 60, 1, 1441794, 3, 1, 2, 65573, 1, 655362, 65572, 1, 655362, 131105, 1, 655362, 4, 1, 2, 65571, 1, 655362, 63, 1, 1441794, 131107, 1, 655362, 131116, 1, 2, 6, 1, 2, 131109, 1, 655365, 8, 1, 2, 67, 1, 1441794, 131117, 1, 2, 65583, 1, 2, 68, 1, 1441794, 65580, 1, 2, 131115, 1, 2, 65584, 1, 2, 131113, 1, 2, 65585, 1, 2, 131112, 1, 1048578, 131108, 1, 655362, 65581, 1, 2, 51, 1, 1441794, 65582, 1, 2, 65, 1, 1441794, 7, 1, 2, 12, 1, 2, 131110, 1, 655364, 10, 1, 2, 65590, 0, 2, 65571, 0, 655362, 29, 0, 2, 65589, 0, 2, 262205, 0, 2, 12, 0, 2, 65573, 0, 655362, 65572, 0, 655362, 23, 0, 2, 65587, 0, 2, 61, 0, 1441794, 30, 0, 2, 65592, 0, 2, 262184, 0, 1048578, 65588, 0, 2, 60, 0, 1441794, 55, 0, 1441794, 65599, 0, 2, 59, 0, 1441794, 22, 0, 2, 65591, 0, 2, 17, 0, 2, 65595, 0, 2, 65574, 0, 655362, 262202, 0, 2, 14, 0, 2, 262204, 0, 2, 65575, 0, 1048578, 54, 0, 1441794, 262196, 0, 2, 65598, 0, 2, 262201, 0, 2, 65593, 0, 2, 33, 0, 2, 32, 0, 2, 65586, 0, 2, 262200, 0, 2, 262208, 0, 2, 262207, 0, 2, 65597, 0, 2, 262195, 0, 2, 262180, 0, 655362, 262181, 0, 655362, 63, 0, 1441794, 262199, 0, 2, 65600, 0, 2, 64, 0, 1441794, 24, 0, 2, 262206, 0, 2, 65594, 0, 2, 262198, 0, 2, 65576, 0, 1048578, 65596, 0, 2, 11, 0, 2, 327730, 0, 2, 262197, 0, 2, 31, 0, 2, 21, 0, 2, 262203, 0, 2, 28, 0, 2, 13, 0, 2, 262179, 0, 655362, 52, 0, 1441794, 68, 0, 1441794, 196645, 0, 655362, 35, 0, 2, 131112, 0, 1048578, 196663, 0, 2, 36, 0, 2, 10, 0, 2, 196659, 0, 2, 65, 0, 1441794, 196662, 0, 2, 196644, 0, 655362, 41, 0, 2, 9, 0, 2, 196643, 0, 655362, 131111, 0, 1048578, 131122, 0, 2, 46, 0, 2, 42, 0, 2, 196661, 0, 2, 196660, 0, 2, 196648, 0, 1048578, 45, 0, 2, 196671, 0, 2, 196667, 0, 2, 37, 0, 2, 51, 0, 1441794, 196668, 0, 2, 66, 0, 1441794, 196672, 0, 2, 131136, 0, 2, 196670, 0, 2, 196669, 0, 2, 67, 0, 1441794, 8, 0, 2, 38, 0, 2, 131108, 0, 655362, 131124, 0, 2, 131123, 0, 2, 34, 0, 2, 7, 0, 2, 131110, 0, 655362, 53, 0, 1441794, 131109, 0, 655362, 196646, 0, 655362, 131135, 0, 2, 6, 0, 2, 4, 0, 2, 131107, 0, 655362, 131134, 0, 2, 262182, 0, 655362, 47, 0, 2, 131130, 0, 2, 3, 0, 2, 58, 0, 1441794, 69, 0, 1441794, 262183, 0, 1048578, 262194, 0, 2, 25, 0, 2, 2, 0, 2, 57, 0, 1441794, 16, 0, 2, 62, 0, 1441794, 20, 0, 2, 26, 0, 2, 15, 0, 2, 18, 0, 2, 19, 0, 2, 27, 0, 2, 56, 0, 1441794, 43, 0, 2, 131129, 0, 2, 196647, 0, 1048578, 131126, 0, 2, 44, 0, 2, 1, 0, 2, 131127, 0, 2, 196666, 0, 2, 50, 0, 2, 131133, 0, 2, 196658, 0, 2, 0, 0, 2, 131132, 0, 2, 39, 0, 2, 70, 0, 1441794, 131128, 0, 2, 40, 0, 2, 5, 0, 2, 196664, 0, 2, 49, 0, 2, 131131, 0, 2, 131125, 0, 2, 196665, 0, 2, 48, 0, 2, 393266, 0, 2, 393266, 1, 2, 393266, 2, 2, 393266, 3, 2, 458802, 0, 2, 458802, 1, 2, 458802, 2, 2, 458802, 3, 2, 524338, 0, 2, 524338, 1, 2, 524338, 2, 2, 524338, 3, 2, 589874, 0, 2, 589874, 1, 2, 589874, 2, 2, 589874, 3, 2, 524339, 0, 2, 524339, 1, 2, 524339, 2, 2, 524340, 0, 2, 524340, 1, 2, 524340, 2, 2, 53, 5, 2, 54, 5, 2, 45, 5, 2, 46, 5, 2, 45, 6, 2, 45, 7, 2, 45, 8, 2, 46, 6, 2, 46, 7, 2, 46, 8, 2, 47, 6, 2, 47, 7, 2, 47, 8, 2, 48, 6, 2, 48, 7, 2, 48, 8, 2, 49, 6, 2, 49, 7, 2, 49, 8, 2, 50, 6, 2, 50, 7, 2, 50, 8, 2, 51, 6, 2, 51, 7, 2, 51, 8, 2, 52, 6, 2, 52, 7, 2, 52, 8, 2, 53, 6, 2, 53, 7, 2, 53, 8, 2, 54, 6, 2, 54, 7, 2, 54, 8, 2, 47, 5, 2, 48, 5, 2, 49, 5, 2, 50, 5, 2, 51, 5, 2, 52, 5, 2, 65586, 5, 2, 65587, 5, 2, 65588, 5, 2, 131123, 5, 2, 131124, 5, 2, 196659, 5, 2, 196660, 5, 2, 196661, 5, 2, 55, 5, 2, 65591, 5, 2, 131127, 5, 2, 40, 5, 2, 40, 6, 2, 40, 7, 2, 40, 8, 2, 40, 9, 2, 40, 10, 2, 41, 5, 2, 41, 6, 2, 41, 7, 2, 41, 8, 2, 41, 9, 2, 41, 10, 2, 42, 5, 2, 42, 6, 2, 42, 7, 2, 42, 8, 2, 42, 9, 2, 42, 10, 2, 43, 5, 2, 43, 6, 2, 43, 7, 2, 43, 8, 2, 43, 9, 2, 43, 10, 2, 44, 5, 2, 44, 6, 2, 44, 7, 2, 44, 8, 2, 44, 9, 2, 44, 10, 2, 45, 9, 2, 45, 10, 2, 46, 9, 2, 46, 10, 2, 47, 9, 2, 47, 10, 2, 48, 9, 2, 48, 10, 2, 49, 9, 2, 49, 10, 2, 50, 9, 2, 50, 10, 2, 51, 9, 2, 51, 10, 2, 52, 9, 2, 52, 10, 2, 53, 9, 2, 53, 10, 2, 54, 9, 2, 54, 10, 2, 55, 6, 2, 55, 7, 2, 55, 8, 2, 55, 9, 2, 55, 10, 2, 56, 5, 2, 56, 6, 2, 56, 7, 2, 56, 8, 2, 56, 9, 2, 56, 10, 2, 57, 5, 2, 57, 6, 2, 57, 7, 2, 57, 8, 2, 57, 9, 2, 57, 10, 2, 58, 5, 2, 58, 6, 2, 58, 7, 2, 58, 8, 2, 58, 9, 2, 58, 10, 2, 59, 5, 2, 59, 6, 2, 59, 7, 2, 59, 8, 2, 59, 9, 2, 59, 10, 2, 60, 5, 2, 60, 6, 2, 60, 7, 2, 60, 8, 2, 60, 9, 2, 60, 10, 2, 196663, 5, 2, 196662, 5, 2, 262184, 5, 2, 65576, 5, 2, 131112, 5, 2, 196648, 5, 2, 262194, 4, 2, 262194, 5, 2, 327730, 4, 2, 327730, 5, 2, 131122, 5, 2, 196658, 5, 2, 65596, 5, 2, 131132, 5, 2, 196668, 5, 2, 262204, 5, 2, 327740, 5, 2, 262195, 5, 2, 262196, 5, 2, 262197, 5, 2, 262198, 5, 2, 262199, 5, 2, 327731, 5, 2, 327732, 5, 2, 327733, 5, 2, 327734, 5, 2, 327735, 5, 2, 327731, 2, 2, 327731, 3, 2, 327731, 4, 2, 327732, 2, 2, 327732, 3, 2, 327732, 4, 2, 327733, 2, 2, 327733, 3, 2, 327733, 4, 2, 327734, 2, 2, 327734, 3, 2, 327734, 4, 2, 327735, 2, 2, 327735, 3, 2, 327735, 4, 2, 327731, 0, 2, 327731, 1, 2, 327732, 0, 2, 327732, 1, 2, 327733, 0, 2, 327733, 1, 2, 327734, 0, 2, 327734, 1, 2, 327735, 0, 2, 327735, 1, 2, 327736, 5, 2, 327737, 5, 2, 327738, 5, 2, 327739, 5, 2, 16, 4, 1441794, 17, 4, 1441794, 18, 4, 1441794, 19, 4, 1441794, 20, 4, 1441794, 21, 4, 1441794, 65555, 4, 1441794, 65556, 4, 1441794, 65557, 4, 1441794, 65552, 4, 1441795, 65553, 4, 1441795, 65554, 4, 1441795, 65551, 3, 4, 65551, 4, 4, 196658, 4, 2) } script = ExtResource("3_gavly") metadata/_custom_type_script = ExtResource("3_gavly") -metadata/_editor_floor_ = Vector3(9, 5, 2) +metadata/_editor_floor_ = Vector3(9, 1, 2) [node name="LevelGridSub" type="GridMap" parent="."] mesh_library = ExtResource("2_8ku8g") @@ -63,7 +63,7 @@ metadata/_editor_floor_ = Vector3(0, 1, 0) [node name="BornPos" type="Node3D" parent="."] unique_name_in_owner = true -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 73.8003, 3.56, 4) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 54.75, 2.02869, 5.2088) [node name="Levels" type="Node3D" parent="."] unique_name_in_owner = true diff --git a/script/_global/util.gd b/script/_global/util.gd index 6e41d9b..8caeb00 100644 --- a/script/_global/util.gd +++ b/script/_global/util.gd @@ -33,7 +33,9 @@ func get_level_grid_pos(pos: Vector3) -> Vector3i: var ret: Vector3i = Vector3i(get_div_scale(pos.x, grid_size), get_div_scale(pos.y, grid_size), get_div_scale(pos.z, grid_size)) return ret + func get_level_grid_pos2(pos: Vector3) -> Vector3i: + pos += Vector3.ONE * Setting.pixel_size* Setting.grid_pixel_size; var grid_size: float = Setting.pixel_size* Setting.grid_pixel_size * 2 var ret: Vector3i = Vector3i(get_div_scale(pos.x, grid_size), get_div_scale(pos.y, grid_size), get_div_scale(pos.z, grid_size)) return ret @@ -44,6 +46,11 @@ func get_level_float_pos(pos: Vector3i) -> Vector3: return Vector3(pos.x*grid_size, pos.y*grid_size, pos.z*grid_size) +func get_level_float_pos2(pos: Vector3i) -> Vector3: + var grid_size: float = Setting.pixel_size* Setting.grid_pixel_size * 2 + return Vector3(pos.x*grid_size, pos.y*grid_size, pos.z*grid_size) + + func get_level_id(pos: Vector3) -> Vector3i: var ret: Vector3i = Vector3i(get_div_scale(pos.x, Setting.size_basic.x), get_div_scale(pos.y, Setting.size_basic.y), get_div_scale(pos.z, Setting.size_basic.z)) return ret diff --git a/script/level/level.gd b/script/level/level.gd index c0cc816..b53c275 100644 --- a/script/level/level.gd +++ b/script/level/level.gd @@ -13,6 +13,10 @@ func init() -> void: grid_block_material.set_shader_parameter("is_target", true) grid_block_material.set_shader_parameter("is_focus", true) + for level_instance in level_instance_list: + level_instance.init_level_character() + level_instance.init_level_main() + func get_level_instance_list() -> Array[LevelInstance]: if not level_instance_list: @@ -28,7 +32,6 @@ func get_level_instance_list() -> Array[LevelInstance]: rooms_node_child_child.level_area_cfg = rooms_node_child.cfg rooms_node_child_child.set_level_range_visible(false) level_instance_list.append(rooms_node_child_child) - rooms_node_child_child.init() return level_instance_list diff --git a/script/level/level_instance.gd b/script/level/level_instance.gd index 547b959..51e85ab 100644 --- a/script/level/level_instance.gd +++ b/script/level/level_instance.gd @@ -70,16 +70,11 @@ func set_level_range_visible(value: bool) -> void: level_range.visible = value -func init() -> void: - init_level_character() - init_level_main() - - func set_focus() -> void: var level_range: CSGBox3D = $LevelRange as CSGBox3D var level_size: Vector3 = level_range.size - var focus_min: Vector3 = get_global_position() + Vector3(0.640001, 0.640001, 0.640001) - var focus_max: Vector3 = get_global_position() + level_size - Vector3(0.640001, 0.639999, 0.639999) + var focus_min: Vector3 = get_global_position() - Vector3(0.640001, 0.640001, 0.640001) + var focus_max: Vector3 = get_global_position() + level_size + Vector3(0.640001, 0.640001, 0.640001) grid_block_material.set_shader_parameter("focus_min", focus_min) grid_block_material.set_shader_parameter("focus_max", focus_max) @@ -139,13 +134,9 @@ func init_level_main() -> void: mark_white_list.clear() mark_black_list.clear() grid_main_cache_cells.clear() - var id_min: Vector3i = Util.get_level_grid_pos2(pos_min()) - var id_max: Vector3i = Util.get_level_grid_pos2(pos_max()) - # 正前面 - for x in range(id_min.x, id_max.x+1): - for y in range(id_min.y, id_max.y+1): - var pos: Vector3i = Vector3i(x, y, id_max.z) - add_grid_main_cache_cell(level_main, pos) + var id_min: Vector3i = Util.get_level_grid_pos2(pos_min()) + var id_max: Vector3i = Util.get_level_grid_pos2(pos_max()) + # 底面黑块 for x in range(id_min.x, id_max.x+1): for z in range(id_min.z, id_max.z+1): @@ -154,24 +145,87 @@ func init_level_main() -> void: if not(id == GridMap.INVALID_CELL_ITEM or z == id_max.z): continue mark_black_list.append(pos) + + # 底面黑块剔除 + var mark_black_remove_list: Array[Vector3i] = [] + for mark_black in mark_black_list: + var is_edge: bool + var check_dir: Vector3i + if mark_black.x == id_min.x: + check_dir = Vector3i(-1, 0, 0); is_edge=true; + elif mark_black.z == id_min.z: + check_dir = Vector3i(0, 0, -1); is_edge=true; + elif mark_black.x == id_max.x: + check_dir = Vector3i(1, 0, 0); is_edge=true; + elif mark_black.z == id_max.z: + check_dir = Vector3i(0, 0, 1); is_edge=true; + else: + check_dir = Vector3i(0, -1, 0) + + if mark_black in [ + Vector3i(id_min.x, id_min.y, id_min.z), + Vector3i(id_max.x, id_min.y, id_min.z), + Vector3i(id_min.x, id_min.y, id_max.z), + Vector3i(id_max.x, id_min.y, id_max.z) + ]: + continue + + if is_edge: + var is_hole: bool + for y in range(id_min.y+1, id_max.y): + var pos: Vector3i = Vector3i(mark_black.x, y, mark_black.z) + if not check_grid(level_main, pos): + is_hole = true + break + if not is_hole: + continue + + var mark_black_check: Vector3i = mark_black + check_dir + var float_pos_check: Vector3 = Util.get_level_float_pos2(mark_black_check) + Vector3(0.64, 0, 0.64) + if not (Global.level_mgr.get_level_by_pos(float_pos_check) and not check_grid(level_main, float_pos_check)): + continue + mark_black_remove_list.append(mark_black) + mark_black_list = mark_black_list.filter(func (x): return x not in mark_black_remove_list) + # 底面黑块延申空气墙 for mark_black in mark_black_list: - for y in range(id_min.y, id_max.y): + add_grid_main_cache_cell(level_main, mark_black) + for y in range(id_min.y+1, id_max.y): var pos: Vector3i = Vector3i(mark_black.x, y, mark_black.z) add_grid_main_cache_cell(level_main, pos) mark_white_list.append(pos) + # 底面黑块剔除延申空气墙 + for mark_black in mark_black_remove_list: + for y in range(id_min.y+1, id_max.y): + var pos: Vector3i = Vector3i(mark_black.x, y, mark_black.z) + if not check_grid(level_main, pos): + continue + add_grid_main_cache_cell(level_main, pos) + mark_white_list.append(pos) # 顶面 for x in range(id_min.x, id_max.x+1): for z in range(id_min.z, id_max.z+1): var pos: Vector3i = Vector3i(x, id_max.y, z) add_grid_main_cache_cell(level_main, pos) + if z == id_max.z: + mark_white_list.append(pos) + continue var pos_down: Vector3i = Vector3i(x, id_max.y - 1, z) if level_main.get_cell_item(pos_down) == GridMap.INVALID_CELL_ITEM: + var pos_up: Vector3i = Vector3i(x, id_max.y + 1, z) + var float_pos_check: Vector3 = Util.get_level_float_pos2(pos_up) + Vector3(0.64, 0, 0.64) + if Global.level_mgr.get_level_by_pos(float_pos_check) and not check_grid(level_main, pos_up): + continue mark_white_list.append(pos) else: mark_black_list.append(pos) +func check_grid(level_main: GridMap, pos: Vector3i) -> bool: + var id: int = level_main.get_cell_item(pos) + return id != GridMap.INVALID_CELL_ITEM + + func add_grid_main_cache_cell(level_main: GridMap, pos: Vector3i) -> void: var id: int = level_main.get_cell_item(pos) if id == GridMap.INVALID_CELL_ITEM: @@ -183,9 +237,15 @@ func add_grid_main_cache_cell(level_main: GridMap, pos: Vector3i) -> void: grid_main_cache_cells.append(cache_data) -func set_replace(is_active: bool)-> void: +func set_replace(is_active: bool, last_grid_main_cache_cells: Array[GridMainCacheCellData] = [])-> void: var level_main: GridMap = %LevelGridMain as GridMap if is_active: + var id_min: Vector3i = Util.get_level_grid_pos2(pos_min()) + var id_max: Vector3i = Util.get_level_grid_pos2(pos_max()) + for cache_data in last_grid_main_cache_cells: + if cache_data.pos.x < id_min.x or cache_data.pos.z < id_min.z or cache_data.pos.x > id_max.x or cache_data.pos.z > id_max.z: + continue + level_main.set_cell_item(cache_data.pos, cache_data.id, cache_data.orientation) for cache_data in grid_main_cache_cells: level_main.set_cell_item(cache_data.pos, GridMap.INVALID_CELL_ITEM) for pos in mark_white_list: @@ -217,6 +277,10 @@ func get_level_active_spots() -> Array[LevelActiveSpot]: return level_active_spots +func get_grid_main_cache_cells() -> Array[GridMainCacheCellData]: + return grid_main_cache_cells + + func pos_min() -> Vector3: return get_global_position() diff --git a/script/manager/level_manager.gd b/script/manager/level_manager.gd index b000a78..7223c32 100644 --- a/script/manager/level_manager.gd +++ b/script/manager/level_manager.gd @@ -63,7 +63,7 @@ func on_character_pos_changed(id: int, pos: Vector3): set_player_position(pos) -func on_character_die(id: int): +func on_character_die(id: int) -> void: if id in current_enmey: current_enmey.remove_at(current_enmey.find(id)) #强制战斗关卡通关 @@ -79,8 +79,7 @@ func on_character_die(id: int): func set_player_position(pos: Vector3) -> void: level.set_player_position(pos) - var new_id: Vector3i = Util.get_level_id(pos) - var new_level_instance: LevelInstance = level_instance_dict.get(new_id) + var new_level_instance: LevelInstance = get_level_by_pos(pos) if not new_level_instance: return #todo 不存在的关卡 主角直接死亡 if cur_level_instance: @@ -118,7 +117,11 @@ func enter_level() -> void: var replace_level_instance: LevelInstance = replace_cache.pop_at(0) if replace_level_instance != cur_level_instance: replace_level_instance.set_replace(false) - cur_level_instance.set_replace(true) + if len(replace_cache) >= 2: + var replace_level_instance: LevelInstance = replace_cache[0] + cur_level_instance.set_replace(true, replace_level_instance.get_grid_main_cache_cells()) + else: + cur_level_instance.set_replace(true) level_loading_rate = 1-level_loading_rate SignalManager.level_size_change.emit(cur_level_instance.get_level_size()) @@ -173,3 +176,16 @@ func enemy_born(count: int) -> bool: Global.character_mgr.create_character(cfg, Enum.ETeam.Monster, character_spot.pos) enemy_count += 1 return true + + +func get_level_by_pos(pos: Vector3) -> LevelInstance: + var level_id: Vector3i = Util.get_level_id(pos) + if level_id in level_instance_dict: + return level_instance_dict.get(level_id) + return null + + +func get_cur_level_name() -> String: + if not cur_level_instance: + return "" + return cur_level_instance.get_name() \ No newline at end of file diff --git a/script/ui/hud/player_status_item.gd b/script/ui/hud/player_status_item.gd index 92923e7..0af3922 100644 --- a/script/ui/hud/player_status_item.gd +++ b/script/ui/hud/player_status_item.gd @@ -15,8 +15,12 @@ func _process(_delta: float) -> void: var player: Character = Global.character_mgr.get_player() if not player: return - refresh_debug_info("break_level", str(player.get_status("break_level"))) - refresh_debug_info("stance", str(player.get_status("stance"))) + refresh_debug_info("硬直等级", str(player.get_status("break_level"))) + refresh_debug_info("姿态", str(player.get_status("stance"))) + refresh_debug_info("位置", str(player.pos())) + refresh_debug_info("关卡", Global.level_mgr.get_cur_level_name()) + refresh_debug_info("关卡坐标", str(Util.get_level_grid_pos2(player.pos()))) + refresh_debug_info("关卡浮点坐标", str(Util.get_level_float_pos2(Util.get_level_grid_pos2(player.pos())))) func refresh_debug_info(label_value: String, value: String) -> void: