冰冻+人机

This commit is contained in:
2026-06-16 19:12:37 +08:00
parent e1414d8afb
commit 2c99d87f09
33 changed files with 312 additions and 32 deletions
+1
View File
@@ -867,6 +867,7 @@ MonoBehaviour:
yzID:
colliderList: []
lockPoint: {fileID: 4349160784336160}
bingDongEffect: {fileID: 1324524035925113}
rotationPY: 60
isRotate: 1
ischild0: 1
+1
View File
@@ -173,6 +173,7 @@ MonoBehaviour:
yzID:
colliderList: []
lockPoint: {fileID: 1405984034862842241}
bingDongEffect: {fileID: 1027515542553082}
rotationPY: 60
isRotate: 1
ischild0: 1
+1
View File
@@ -74,6 +74,7 @@ MonoBehaviour:
yzID:
colliderList: []
lockPoint: {fileID: 5160452591210362217}
bingDongEffect: {fileID: 3643997932609183493}
rotationPY: 60
isRotate: 1
ischild0: 1
+1
View File
@@ -3228,6 +3228,7 @@ MonoBehaviour:
yzID:
colliderList: []
lockPoint: {fileID: 4108292045619495}
bingDongEffect: {fileID: 1858456301263913}
rotationPY: 60
isRotate: 1
ischild0: 1
+1
View File
@@ -113,6 +113,7 @@ MonoBehaviour:
yzID:
colliderList: []
lockPoint: {fileID: 4147506383744998}
bingDongEffect: {fileID: 1300856991666655}
rotationPY: 60
isRotate: 1
ischild0: 1
+113
View File
@@ -74,6 +74,7 @@ MonoBehaviour:
yzID:
colliderList: []
lockPoint: {fileID: 6464679825453359357}
bingDongEffect: {fileID: 1553613233914171115}
rotationPY: 60
isRotate: 1
ischild0: 1
@@ -110,6 +111,117 @@ Transform:
- {fileID: 853463365368057848}
m_Father: {fileID: 6464679825453359357}
m_LocalEulerAnglesHint: {x: -2.412969, y: -4.752446, z: 2.948498}
--- !u!1 &1553613233914171115
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 156482802418479094}
- component: {fileID: 8224179882909899582}
m_Layer: 6
m_Name: 20 (1)
m_TagString: Fish
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &156482802418479094
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1553613233914171115}
serializedVersion: 2
m_LocalRotation: {x: -0.7170504, y: -0.026710156, z: -0.08326528, w: 0.69151443}
m_LocalPosition: {x: 0.035445213, y: -0.08414776, z: 0.018373985}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1555986309729892503}
m_LocalEulerAnglesHint: {x: -91.726, y: 8.9952, z: 4.4627066}
--- !u!137 &8224179882909899582
SkinnedMeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1553613233914171115}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 3
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: ef789d1aba051724389659e4f4bd6e28, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
serializedVersion: 2
m_Quality: 0
m_UpdateWhenOffscreen: 0
m_SkinnedMotionVectors: 1
m_Mesh: {fileID: 4300000, guid: 10a326622a4b1ae43822163448b7791f, type: 2}
m_Bones:
- {fileID: 8817857883169006592}
- {fileID: 1674123089844349894}
- {fileID: 6337152729433652255}
- {fileID: 2374288173428043804}
- {fileID: 5802454806732734764}
- {fileID: 853463365368057848}
- {fileID: 9119412146680501345}
- {fileID: 3449192957322042352}
- {fileID: 5637544075689725997}
- {fileID: 2988130092747793642}
- {fileID: 6464679825453359357}
- {fileID: 4209855705527888521}
- {fileID: 1479274583559721758}
- {fileID: 2982970368894880303}
- {fileID: 5261331154825876781}
- {fileID: 3364215003819410530}
- {fileID: 3626844121400460444}
- {fileID: 5506783410894516037}
- {fileID: 4724596155733519483}
- {fileID: 5927445831551671564}
- {fileID: 4291544056284190087}
- {fileID: 7582298532895908841}
- {fileID: 4282593479381778643}
- {fileID: 5403299097872419835}
- {fileID: 4212293767069468283}
- {fileID: 1914858866714806375}
m_BlendShapeWeights: []
m_RootBone: {fileID: 6464679825453359357}
m_AABB:
m_Center: {x: -0.51744473, y: -0.050143838, z: -0.016705751}
m_Extent: {x: 1.2791513, y: 0.6163311, z: 0.71437395}
m_DirtyAABB: 0
--- !u!1 &2344038593300312561
GameObject:
m_ObjectHideFlags: 0
@@ -1419,6 +1531,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 6561500456186177281}
- {fileID: 156482802418479094}
- {fileID: 6464679825453359357}
- {fileID: 363755515978564236}
m_Father: {fileID: 4160130377520515}
+1
View File
@@ -74,6 +74,7 @@ MonoBehaviour:
yzID:
colliderList: []
lockPoint: {fileID: 416801631476525717}
bingDongEffect: {fileID: 3503211314645075885}
rotationPY: 60
isRotate: 1
ischild0: 1
+1
View File
@@ -74,6 +74,7 @@ MonoBehaviour:
yzID:
colliderList: []
lockPoint: {fileID: 6779638588673718637}
bingDongEffect: {fileID: 3736285281318940347}
rotationPY: 60
isRotate: 1
ischild0: 1
+1
View File
@@ -74,6 +74,7 @@ MonoBehaviour:
yzID:
colliderList: []
lockPoint: {fileID: 9011069198357211444}
bingDongEffect: {fileID: 8075606180625606183}
rotationPY: 60
isRotate: 1
ischild0: 1
+1
View File
@@ -75,6 +75,7 @@ MonoBehaviour:
yzID:
colliderList: []
lockPoint: {fileID: 9077545747240837144}
bingDongEffect: {fileID: 2857924079337683266}
rotationPY: 60
isRotate: 1
ischild0: 1
+1
View File
@@ -3756,6 +3756,7 @@ MonoBehaviour:
yzID:
colliderList: []
lockPoint: {fileID: 4704810729820477}
bingDongEffect: {fileID: 1022712634869450}
rotationPY: 60
isRotate: 1
ischild0: 1
+1
View File
@@ -5501,6 +5501,7 @@ MonoBehaviour:
yzID:
colliderList: []
lockPoint: {fileID: 4907652686015682}
bingDongEffect: {fileID: 1216098537051468}
rotationPY: 60
isRotate: 1
ischild0: 1
+6 -5
View File
@@ -75,6 +75,7 @@ MonoBehaviour:
yzID:
colliderList: []
lockPoint: {fileID: 5735260583413910674}
bingDongEffect: {fileID: 3673896510524144375}
rotationPY: 60
isRotate: 1
ischild0: 1
@@ -4408,7 +4409,8 @@ Transform:
m_LocalPosition: {x: -0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Children:
- {fileID: 901056108255091812}
m_Father: {fileID: 8164725383347027367}
m_LocalEulerAnglesHint: {x: -90, y: -0, z: 0}
--- !u!137 &233140569928092558
@@ -8955,12 +8957,12 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6947550079924107478}
serializedVersion: 2
m_LocalRotation: {x: -0.7071068, y: 0, z: -0, w: 0.7071068}
m_LocalPosition: {x: -0, y: 0, z: 0}
m_LocalRotation: {x: 0.00000005960463, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8164725383347027367}
m_Father: {fileID: 1171127895997530143}
m_LocalEulerAnglesHint: {x: -90, y: -0, z: 0}
--- !u!137 &1359412228248111869
SkinnedMeshRenderer:
@@ -12352,7 +12354,6 @@ Transform:
- {fileID: 7066903545550363775}
- {fileID: 5735260583413910674}
- {fileID: 1171127895997530143}
- {fileID: 901056108255091812}
m_Father: {fileID: 1834397329183834694}
m_LocalEulerAnglesHint: {x: 0, y: -0, z: -0}
--- !u!95 &5714589800498889945
+1
View File
@@ -75,6 +75,7 @@ MonoBehaviour:
yzID:
colliderList: []
lockPoint: {fileID: 6464927967239605888}
bingDongEffect: {fileID: 4730624530684379271}
rotationPY: 60
isRotate: 1
ischild0: 1
+6 -5
View File
@@ -11259,12 +11259,12 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1241435925262373}
serializedVersion: 2
m_LocalRotation: {x: -0.7071068, y: 0, z: -0, w: 0.7071068}
m_LocalPosition: {x: -0, y: 0, z: 0}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -0.8025123}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 4744538623373837}
m_Father: {fileID: 4034172849237407}
m_LocalEulerAnglesHint: {x: -90, y: -0, z: 0}
--- !u!137 &137742287452312877
SkinnedMeshRenderer:
@@ -15736,6 +15736,7 @@ MonoBehaviour:
yzID:
colliderList: []
lockPoint: {fileID: 4209954521699066}
bingDongEffect: {fileID: 1765481456260392}
rotationPY: 30
isRotate: 1
ischild0: 1
@@ -19185,7 +19186,8 @@ Transform:
m_LocalPosition: {x: -0, y: 0.80251217, z: 0.000000038146972}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Children:
- {fileID: 4340356888789568}
m_Father: {fileID: 4744538623373837}
m_LocalEulerAnglesHint: {x: -90, y: -0, z: 0}
--- !u!137 &137042502547329848
@@ -23511,7 +23513,6 @@ Transform:
- {fileID: 4812118049684569}
- {fileID: 4988080371766819}
- {fileID: 4034172849237407}
- {fileID: 4340356888789568}
m_Father: {fileID: 4321846029186879}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!95 &95278784026729692
+1
View File
@@ -5087,6 +5087,7 @@ MonoBehaviour:
yzID:
colliderList: []
lockPoint: {fileID: 4484009351375374}
bingDongEffect: {fileID: 1314882004242357}
rotationPY: 60
isRotate: 1
ischild0: 1
+3 -2
View File
@@ -16,7 +16,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!4 &4838960281201077
Transform:
m_ObjectHideFlags: 0
@@ -74,6 +74,7 @@ MonoBehaviour:
yzID:
colliderList: []
lockPoint: {fileID: 1855886116175055501}
bingDongEffect: {fileID: 5957202782735178292}
rotationPY: 30
isRotate: 1
ischild0: 1
@@ -3733,7 +3734,7 @@ SkinnedMeshRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 17389e5b2b846e047b90d04057dd87ee, type: 2}
- {fileID: 2100000, guid: 1e83e9616ffa54b48aa229adb1d99d17, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
+1
View File
@@ -311,6 +311,7 @@ MonoBehaviour:
yzID:
colliderList: []
lockPoint: {fileID: 4472675622309697}
bingDongEffect: {fileID: 1851492673024927}
rotationPY: 60
isRotate: 1
ischild0: 1
+1
View File
@@ -8882,6 +8882,7 @@ MonoBehaviour:
yzID:
colliderList: []
lockPoint: {fileID: 4448051913711258146}
bingDongEffect: {fileID: 1586437519072410}
rotationPY: 60
isRotate: 1
ischild0: 1
+1
View File
@@ -5415,6 +5415,7 @@ MonoBehaviour:
yzID:
colliderList: []
lockPoint: {fileID: 2411100319696574627}
bingDongEffect: {fileID: 1512764231174227}
rotationPY: 60
isRotate: 1
ischild0: 1
+1
View File
@@ -142,6 +142,7 @@ MonoBehaviour:
yzID:
colliderList: []
lockPoint: {fileID: 4023875916136523}
bingDongEffect: {fileID: 1826309244165380}
rotationPY: 60
isRotate: 1
ischild0: 1
+2 -3
View File
@@ -16,7 +16,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!4 &4211869767440078
Transform:
m_ObjectHideFlags: 0
@@ -74,6 +74,7 @@ MonoBehaviour:
yzID:
colliderList: []
lockPoint: {fileID: 3914299091016471527}
bingDongEffect: {fileID: 9172291765617301086}
rotationPY: 60
isRotate: 1
ischild0: 1
@@ -2693,7 +2694,6 @@ ParticleSystemRenderer:
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: f974363fd7ec0b247a9b25319978664e, type: 2}
- {fileID: 2100000, guid: f974363fd7ec0b247a9b25319978664e, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@@ -5787,7 +5787,6 @@ ParticleSystemRenderer:
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 8d8ebd2fa757e8a47bef9a1025c8be54, type: 2}
- {fileID: 2100000, guid: 8d8ebd2fa757e8a47bef9a1025c8be54, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@@ -80,6 +80,13 @@ public class MonsterContral : MonoBehaviour
/// <summary>是否处于移动状态(false 时 Update 跳过移动计算)</summary>
public bool isMove = true;
/// <summary>设置冰冻特效激活状态</summary>
public void SetFreezeEffect(bool active)
{
if (bingDongEffect != null)
bingDongEffect.SetActive(active);
}
/// <summary>是否为 3D 鱼(影响朝向轴选取)</summary>
public bool is3D = false;
@@ -117,6 +124,8 @@ public class MonsterContral : MonoBehaviour
public List<Transform> colliderList;
/// <summary>锁定点(colliderList 为空时使用,null 则用自身坐标)</summary>
public Transform lockPoint;
/// <summary>冰冻特效(预制体内子物体,null 则跳过)</summary>
public GameObject bingDongEffect;
/// <summary>是否存活(活跃且未被回收)</summary>
public bool IsAlive => gameObject.activeInHierarchy;
@@ -1772,6 +1772,7 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
// 定格
m.isMove = false;
m.ChangeState(CharacterStateType.idle);
m.SetFreezeEffect(true);
}
}
}
@@ -1791,6 +1792,7 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
if (m == null || !m.gameObject.activeInHierarchy) continue;
m.isMove = true;
m.SetFreezeEffect(false);
if (frozenFishStates.TryGetValue(m.guid, out var prevState))
m.ChangeState(prevState);
}
+2 -2
View File
@@ -22,8 +22,8 @@ namespace Assets.MyGame.Scripts.Net
//public const string baseURL = "http://8.137.8.46";
#else
//public const string baseURL = "http://8.137.8.46";
public const string baseURL = "http://8.137.163.153";
public const string baseURL = "http://8.137.8.46";
//public const string baseURL = "http://8.137.163.153";
#endif
@@ -84,7 +84,7 @@ namespace Assets.MyGame.Scripts.Net.WebResponses
public float angle;
}
[Serializable]
public class FrameData_FireBullit : FrameData
public class FrameData_FireBullet : FrameData
{
public float angle;
public long gold;
@@ -29,8 +29,8 @@ namespace Assets.MyGame.Scripts.Net
//private const string baseUrl = "ws://8.137.8.46";
#else
//private const string baseUrl = "ws://8.137.8.46";
private const string baseUrl = "ws://8.137.163.153";
private const string baseUrl = "ws://8.137.8.46";
//private const string baseUrl = "ws://8.137.163.153";
#endif
public bool isGame=false;
@@ -96,16 +96,15 @@ namespace Assets.MyGame.Scripts.Net
}
UIManager.Instance.ShowAsync(uIPanel, UIPanel.HomeMainPanel, msg);
//这里
var v = SceneManager.GetSceneByName("XJMH");
if (v.IsValid() && v.isLoaded)
// 卸载所有已加载的游戏地图场景
string[] gameScenes = { "FLZY", "YYSC", "XJMH", "HHWK" };
foreach (var sn in gameScenes)
{
}
else
{
SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive);
var s = SceneManager.GetSceneByName(sn);
if (s.IsValid() && s.isLoaded)
SceneManager.UnloadSceneAsync(sn);
}
SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive);
UIManager.Instance.Close(UIPanel.HomeMainPanel);
WebSocketManager.Instance.isGame = true;
@@ -9,6 +9,8 @@ public class SitPosData : MonoBehaviour
{
/// <summary>本地玩家的座位引用(由游戏面板初始化时设置)</summary>
public static SitPosData localPlayerSit;
/// <summary>当前房间房主座位(人机请求由房主发送,房主退出后自动继承)</summary>
public static SitPosData roomOwnerSit;
// -------------------------
// 玩家基础信息
@@ -17,6 +19,8 @@ public class SitPosData : MonoBehaviour
public string user;
[Tooltip("座位编号 0~3。0,1=下方 2,3=上方")]
public int posID;
[Tooltip("是否为人机")]
public bool isBot = false;
/// <summary>posID>=2 = 上方,需要翻转(0,1=下方;2,3=上方)</summary>
public bool IsFlipped => posID >= 2;
@@ -93,6 +97,33 @@ public class SitPosData : MonoBehaviour
{
if (localPlayerSit == this)
localPlayerSit = null;
// 房主退出 → 自动继承给第一个非人机玩家
if (roomOwnerSit == this)
{
roomOwnerSit = null;
TransferRoomOwner();
}
}
/// <summary>房主退出后,将房主身份转移给第一个活跃的非人机玩家</summary>
public static void TransferRoomOwner()
{
var list = FindObjectsOfType<SitPosData>();
foreach (var sit in list)
{
if (!sit.isBot && sit.gameObject.activeInHierarchy && sit != roomOwnerSit)
{
roomOwnerSit = sit;
break;
}
}
}
/// <summary>分配房主(首个非人机玩家)</summary>
public static void AssignRoomOwner(SitPosData sit)
{
if (roomOwnerSit == null && !sit.isBot)
roomOwnerSit = sit;
}
// ==================== 炮台加载(动态克隆) ====================
@@ -77,7 +77,12 @@ MonoBehaviour:
isyz: 0
yzID:
colliderList: []
lockPoint: {fileID: 0}
bingDongEffect: {fileID: 0}
rotationPY: 60
isRotate: 0
ischild0: 0
depthOffset: 0
bossName: "\u732A\u516B\u6212"
isToUI: 1
tMP_CurrBossScore: {fileID: 0}
@@ -143,6 +143,7 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
[Header("攻击参数")]
public float attackTime = 0.5f;
float clickTime = 0;
private Dictionary<int, float> botFireTimer = new Dictionary<int, float>(); // 人机开火计时
public GameObject bullet_Test;
public GameObject bulletParent;
float changeTurretTime = 0f;
@@ -187,6 +188,29 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
{
JoinGame(item.position, item.gold, item.cannonMultiple, 0, item.userId, item.cannonId);
}
// 生成人机:倒着填空余座位
int botCount = GameManager.Instance.gameData.currRoomData.robotCount;
if (botCount > 0)
{
var usedPositions = new HashSet<int>();
foreach (var p in GameManager.Instance.gameData.currRoomData.players)
usedPositions.Add(p.position);
// 第一个普通炮台的编号作为默认
int defaultTurret = 1;
var turretList = TurretResourcesData.GetTurretDataByType(1);
if (turretList != null && turretList.Count > 0)
defaultTurret = turretList[0].turretNumber;
int botGold = 100000;
int botMultiple = paoBeiList != null && paoBeiList.Count > 0 ? paoBeiList[0] : 100;
for (int pos = list_Sits.Count - 1; pos >= 0 && botCount > 0; pos--)
{
if (usedPositions.Contains(pos)) continue;
JoinGame(pos, botGold, botMultiple, 0, "bot_" + pos, defaultTurret.ToString());
var botSit = list_Sits[pos];
if (botSit != null) botSit.isBot = true;
botCount--;
}
}
GameManager.Instance.gameData.roomJoinNotice = v.arguments[0];
isfirstShow = false;
@@ -215,7 +239,13 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
}
else
{
// 玩家加入 → 如果座位被bot占用则替换
var targetSit = list_Sits.Find(s => s.posID == roomJoinNotice.position);
if (targetSit != null && targetSit.isBot)
{
targetSit.isBot = false;
targetSit.gameObject.SetActive(false);
}
JoinGame(roomJoinNotice.position, roomJoinNotice.gold, roomJoinNotice.cannonMultiple, 0, roomJoinNotice.userId, roomJoinNotice.cannonId);
}
@@ -412,6 +442,7 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
LoopLaser();
SettingClose();
DaoJiShi();
HandleBotAI();
}
float sittingTime = 10;
@@ -1378,7 +1409,7 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
private void SyncFire(float angle, bool isSanShe, bool isDouble, bool isLock)
{
var fireData = new FrameData_FireBullit
var fireData = new FrameData_FireBullet
{
angle = angle,
gold = currSitData.goldNum,
@@ -1496,7 +1527,7 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
{
//if (sync.sitPos == currSitData.posID) return;
var data = FrameDataParser.Parse<FrameData_FireBullit>(sync.extra.frameData);
var data = FrameDataParser.Parse<FrameData_FireBullet>(sync.extra.frameData);
FireBullet(list_Sits[sync.extra.sitPos], data.angle, data.isSanShe, data.twoRTruuect, data.isSuoDing, sync.bulletIds, data.monsterIDs);
}
@@ -1589,6 +1620,9 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
sit.gameObject.SetActive(true);
// 分配房主(首个非人机)
SitPosData.AssignRoomOwner(sit);
// 用该玩家自己的 cannonId 加载炮台
if (!string.IsNullOrEmpty(cannonId) && int.TryParse(cannonId, out int turretNum))
sit.LoadTurret(turretNum);
@@ -1603,4 +1637,72 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
#endregion
#region 人机AI
private void HandleBotAI()
{
// 只有房主控制人机
if (SitPosData.roomOwnerSit == null || currSitData != SitPosData.roomOwnerSit) return;
var fishList = CreateFishManager.Instance;
if (fishList == null || fishList.fishDatas_hashCodekey == null) return;
foreach (var sit in list_Sits)
{
if (!sit.isBot || sit.gameObject.activeSelf == false) continue;
if (sit.tra_CurrTurret == null) continue;
// 找最近鱼
MonsterContral target = null;
float bestDist = float.MaxValue;
Vector3 turretPos = sit.tra_CurrTurret.position;
foreach (var kv in fishList.fishDatas_hashCodekey)
{
var m = kv.Value;
if (m == null || !m.gameObject.activeInHierarchy) continue;
float d = (m.transform.position - turretPos).sqrMagnitude;
if (d < bestDist) { bestDist = d; target = m; }
}
if (target == null) continue;
// 旋转朝向鱼
Vector3 fishWorldPos = target.transform.position;
Vector3 screenPos = Camera.main.WorldToScreenPoint(fishWorldPos);
RotateToTouch(sit, screenPos);
// 定时开火
if (!botFireTimer.ContainsKey(sit.posID))
botFireTimer[sit.posID] = 0f;
botFireTimer[sit.posID] += Time.deltaTime;
if (botFireTimer[sit.posID] >= attackTime)
{
botFireTimer[sit.posID] = 0f;
float angle = sit.currentAngle;
SyncFire_ForBot(sit, angle);
}
}
}
/// <summary>人机开火同步(房主代发)</summary>
private void SyncFire_ForBot(SitPosData botSit, float angle)
{
bool isSanShe = toggle_Three.isOn;
bool isDouble = toggle_Shuang.isOn;
SyncGameData sgd = new SyncGameData
{
sitPos = botSit.posID,
frameType = FrameDataType.fireBullet,
time = BeijingTimeManager.Instance.CurrentTimestampMs,
frameData = new FrameData_FireBullet
{
angle = angle,
gold = botSit.consumeGoldNum,
isSanShe = isSanShe,
twoRTruuect = isDouble,
isSuoDing = false,
}
};
WebSocketSendList.SyncGameData(sgd);
}
#endregion
}
@@ -91,7 +91,7 @@ public class Eff_zhubajie_Skill_AniEvent : MonoBehaviour
}
public void eventTurnEnd()
{
if (index==6)
if (index>=6)
{
anim.Play("skill_end");
FishResourcesData fishResourcesData;