冰冻+人机
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
// ==================== 炮台加载(动态克隆) ====================
|
||||
|
||||
Reference in New Issue
Block a user