2026-05-04 17:21:52 +08:00
|
|
|
|
////using Assets.MyGame.Scripts.Net.API;
|
|
|
|
|
|
////using Spine.Unity;
|
|
|
|
|
|
////using System;
|
|
|
|
|
|
////using System.Collections;
|
|
|
|
|
|
////using System.Collections.Generic;
|
|
|
|
|
|
////using System.Linq;
|
|
|
|
|
|
////using TMPro;
|
|
|
|
|
|
////using Unity.VisualScripting;
|
|
|
|
|
|
////using UnityEngine;
|
|
|
|
|
|
////using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
|
|
////public class SitPosData : MonoBehaviour
|
|
|
|
|
|
////{
|
|
|
|
|
|
//// [Header("用户id")]
|
|
|
|
|
|
//// public string user;
|
|
|
|
|
|
//// [Header("座位id")]
|
|
|
|
|
|
//// public int posID;
|
|
|
|
|
|
//// [Header("金币")]
|
|
|
|
|
|
//// public TextMeshProUGUI tMP_TurretConsumeNum;
|
|
|
|
|
|
//// public TextMeshProUGUI tMP_GoldNum;
|
|
|
|
|
|
|
|
|
|
|
|
//// public Button btn_TurretAdd;
|
|
|
|
|
|
//// public Button btn_TurretMinus;
|
|
|
|
|
|
|
|
|
|
|
|
//// public long goldNum;
|
|
|
|
|
|
//// public long consumeGoldNum;
|
|
|
|
|
|
//// [Header("炮台")]
|
|
|
|
|
|
//// public Dictionary<string, TurretData> dic_Turrets=new Dictionary<string, TurretData>();
|
|
|
|
|
|
//// public List<TurretData> list_Turrets=new List<TurretData>();
|
|
|
|
|
|
//// public int currentTurretIndex = 0;
|
|
|
|
|
|
//// public string currentTurretID = "";
|
|
|
|
|
|
//// public TurretData currentTurret;
|
|
|
|
|
|
//// [Header("锁定")]
|
|
|
|
|
|
//// public MonsterContral monCotl_Lock;
|
|
|
|
|
|
//// public Transform monCotl_Lock_Position;
|
|
|
|
|
|
//// public bool isLock=false;
|
|
|
|
|
|
//// public GameObject lockFX;
|
|
|
|
|
|
|
|
|
|
|
|
//// [Header("当前炮塔")]
|
|
|
|
|
|
//// public Transform tra_CurrTurret;
|
|
|
|
|
|
//// public Transform tra_CurrFly; //星际迷航特有
|
|
|
|
|
|
|
|
|
|
|
|
//// public GameObject changeTurretList;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//// public Action<TurretState> OnStateChange;
|
|
|
|
|
|
|
|
|
|
|
|
//// public void ChangeState(TurretState state)
|
|
|
|
|
|
//// {
|
|
|
|
|
|
//// OnStateChange?.Invoke(state);
|
|
|
|
|
|
//// }
|
|
|
|
|
|
|
|
|
|
|
|
//// public void Awake()
|
|
|
|
|
|
//// {
|
|
|
|
|
|
//// //list_Turrets.Sort((td1,td2) =>
|
|
|
|
|
|
//// //{
|
|
|
|
|
|
//// // return td1.turretID.CompareTo(td2.turretLevel);
|
|
|
|
|
|
//// //});
|
|
|
|
|
|
//// dic_Turrets = list_Turrets.ToDictionary(td => td.turretID);
|
|
|
|
|
|
//// btn_TurretAdd.onClick.AddListener(() =>
|
|
|
|
|
|
//// {
|
|
|
|
|
|
//// ChangeTurretAddConsumeNum(1000);
|
|
|
|
|
|
//// });
|
|
|
|
|
|
//// btn_TurretMinus.onClick.AddListener(() =>
|
|
|
|
|
|
//// {
|
|
|
|
|
|
//// ChangeTurretMinusConsumeNum(1000);
|
|
|
|
|
|
|
|
|
|
|
|
//// });
|
|
|
|
|
|
//// }
|
|
|
|
|
|
//// public void Update()
|
|
|
|
|
|
//// {
|
|
|
|
|
|
|
|
|
|
|
|
//// }
|
|
|
|
|
|
//// public void ChangeTurret(int n=0)
|
|
|
|
|
|
//// {
|
|
|
|
|
|
|
|
|
|
|
|
//// if (currentTurretIndex>list_Turrets.Count|| currentTurretIndex<0)
|
|
|
|
|
|
//// {
|
|
|
|
|
|
//// //currentTurretIndex = currentTurretIndex;
|
|
|
|
|
|
//// }
|
|
|
|
|
|
//// else
|
|
|
|
|
|
//// {
|
|
|
|
|
|
//// currentTurretIndex = n;
|
|
|
|
|
|
//// }
|
|
|
|
|
|
//// if (currentTurret != null)
|
|
|
|
|
|
//// {
|
|
|
|
|
|
//// currentTurret.gameObject.SetActive(false);
|
|
|
|
|
|
//// }
|
|
|
|
|
|
|
|
|
|
|
|
//// currentTurretID = list_Turrets[currentTurretIndex].turretID; //dic_Turrets[currentTurretID];
|
|
|
|
|
|
//// currentTurret=dic_Turrets[currentTurretID];
|
|
|
|
|
|
//// currentTurret.gameObject.SetActive(true);
|
|
|
|
|
|
//// // ⭐ 关键:把状态机入口绑定到当前炮台
|
|
|
|
|
|
//// OnStateChange = currentTurret.ChangeState;
|
|
|
|
|
|
|
|
|
|
|
|
//// gameObject.SetActive(true);
|
|
|
|
|
|
//// tra_CurrTurret =currentTurret.transform.GetChild(0);
|
|
|
|
|
|
//// tra_CurrFly = currentTurret.transform.GetChild(1);
|
|
|
|
|
|
|
|
|
|
|
|
//// }
|
|
|
|
|
|
//// public void ChangeTurretConsumeNum(int n = 0)
|
|
|
|
|
|
//// {
|
|
|
|
|
|
//// consumeGoldNum = n;
|
|
|
|
|
|
//// tMP_TurretConsumeNum.text = consumeGoldNum.ToString();
|
|
|
|
|
|
|
|
|
|
|
|
//// }
|
|
|
|
|
|
//// public void ChangeTurretAddConsumeNum(int n = 0)
|
|
|
|
|
|
//// {
|
|
|
|
|
|
//// consumeGoldNum += n;
|
|
|
|
|
|
//// tMP_TurretConsumeNum.text = consumeGoldNum.ToString();
|
|
|
|
|
|
|
|
|
|
|
|
//// }
|
|
|
|
|
|
//// public void ChangeTurretMinusConsumeNum(int n = 0)
|
|
|
|
|
|
//// {
|
|
|
|
|
|
//// consumeGoldNum -= n;
|
|
|
|
|
|
//// tMP_TurretConsumeNum.text = consumeGoldNum.ToString();
|
|
|
|
|
|
|
|
|
|
|
|
//// }
|
|
|
|
|
|
//// public bool ConsumeGold(int bl=1)
|
|
|
|
|
|
//// {
|
|
|
|
|
|
//// long temp = goldNum - consumeGoldNum*bl;
|
|
|
|
|
|
//// if (temp > 0)
|
|
|
|
|
|
//// {
|
|
|
|
|
|
//// goldNum = temp;
|
|
|
|
|
|
//// tMP_GoldNum.text = goldNum.ToString();
|
|
|
|
|
|
//// return true;
|
|
|
|
|
|
//// }
|
|
|
|
|
|
//// return false;
|
|
|
|
|
|
//// }
|
|
|
|
|
|
////}
|
2026-05-02 23:52:48 +08:00
|
|
|
|
//using System;
|
|
|
|
|
|
//using System.Collections.Generic;
|
|
|
|
|
|
//using System.Linq;
|
|
|
|
|
|
//using TMPro;
|
|
|
|
|
|
//using UnityEngine;
|
|
|
|
|
|
//using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
|
|
//public class SitPosData : MonoBehaviour
|
|
|
|
|
|
//{
|
2026-05-04 17:21:52 +08:00
|
|
|
|
// // -------------------------
|
|
|
|
|
|
// // 玩家信息
|
|
|
|
|
|
// // -------------------------
|
2026-05-02 23:52:48 +08:00
|
|
|
|
// public string user;
|
|
|
|
|
|
// public int posID;
|
2026-05-04 17:21:52 +08:00
|
|
|
|
|
2026-05-02 23:52:48 +08:00
|
|
|
|
// [Header("金币")]
|
2026-05-04 17:21:52 +08:00
|
|
|
|
// public long goldNum;
|
|
|
|
|
|
// public long consumeGoldNum;
|
2026-05-02 23:52:48 +08:00
|
|
|
|
// public TextMeshProUGUI tMP_TurretConsumeNum;
|
|
|
|
|
|
// public TextMeshProUGUI tMP_GoldNum;
|
|
|
|
|
|
|
2026-05-04 17:21:52 +08:00
|
|
|
|
// // -------------------------
|
|
|
|
|
|
// // 炮台管理
|
|
|
|
|
|
// // -------------------------
|
|
|
|
|
|
// public List<TurretData> list_Turrets = new List<TurretData>();
|
|
|
|
|
|
// public Dictionary<string, TurretData> dic_Turrets = new Dictionary<string, TurretData>();
|
2026-05-02 23:52:48 +08:00
|
|
|
|
// public int currentTurretIndex = 0;
|
|
|
|
|
|
// public TurretData currentTurret;
|
|
|
|
|
|
|
2026-05-04 17:21:52 +08:00
|
|
|
|
// // 状态机入口(GameMainPanel 调用)
|
2026-05-02 23:52:48 +08:00
|
|
|
|
// public Action<TurretState> OnStateChange;
|
|
|
|
|
|
|
2026-05-04 17:21:52 +08:00
|
|
|
|
// // -------------------------
|
|
|
|
|
|
// // 炮台旋转
|
|
|
|
|
|
// // -------------------------
|
|
|
|
|
|
// public Transform tra_CurrTurret;
|
|
|
|
|
|
// public float currentAngle;
|
|
|
|
|
|
|
|
|
|
|
|
// // -------------------------
|
|
|
|
|
|
// // 锁定系统
|
|
|
|
|
|
// // -------------------------
|
|
|
|
|
|
// public MonsterContral monCotl_Lock;
|
|
|
|
|
|
// public Transform monCotl_Lock_Position;
|
|
|
|
|
|
// public bool isLock;
|
|
|
|
|
|
// public GameObject lockFX;
|
|
|
|
|
|
|
|
|
|
|
|
// // -------------------------
|
|
|
|
|
|
// // UI
|
|
|
|
|
|
// // -------------------------
|
|
|
|
|
|
// public Button btn_TurretAdd;
|
|
|
|
|
|
// public Button btn_TurretMinus;
|
|
|
|
|
|
// public GameObject changeTurretList;
|
|
|
|
|
|
|
|
|
|
|
|
// private void Awake()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// dic_Turrets = list_Turrets.ToDictionary(t => t.turretID);
|
|
|
|
|
|
|
|
|
|
|
|
// btn_TurretAdd.onClick.AddListener(() => ChangeTurretAddConsumeNum(1000));
|
|
|
|
|
|
// btn_TurretMinus.onClick.AddListener(() => ChangeTurretMinusConsumeNum(1000));
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// // -------------------------
|
|
|
|
|
|
// // 切换炮台
|
|
|
|
|
|
// // -------------------------
|
|
|
|
|
|
// public void ChangeTurret(int index)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (currentTurret != null)
|
|
|
|
|
|
// currentTurret.gameObject.SetActive(false);
|
|
|
|
|
|
|
|
|
|
|
|
// currentTurretIndex = Mathf.Clamp(index, 0, list_Turrets.Count - 1);
|
|
|
|
|
|
// currentTurret = list_Turrets[currentTurretIndex];
|
|
|
|
|
|
// currentTurret.gameObject.SetActive(true);
|
|
|
|
|
|
|
|
|
|
|
|
// // 绑定状态机入口
|
|
|
|
|
|
// OnStateChange = currentTurret.ChangeState;
|
|
|
|
|
|
|
|
|
|
|
|
// // 缓存旋转点
|
|
|
|
|
|
// tra_CurrTurret = currentTurret.transform.GetChild(0);
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// // -------------------------
|
|
|
|
|
|
// // 切换状态(GameMainPanel 调用)
|
|
|
|
|
|
// // -------------------------
|
2026-05-02 23:52:48 +08:00
|
|
|
|
// public void ChangeState(TurretState state)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// OnStateChange?.Invoke(state);
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
2026-05-04 17:21:52 +08:00
|
|
|
|
// // -------------------------
|
|
|
|
|
|
// // 炮台旋转
|
|
|
|
|
|
// // -------------------------
|
|
|
|
|
|
// public void SetRotation(float angle)
|
2026-05-02 23:52:48 +08:00
|
|
|
|
// {
|
2026-05-04 17:21:52 +08:00
|
|
|
|
// currentAngle = angle;
|
|
|
|
|
|
// tra_CurrTurret.rotation = Quaternion.Euler(0, 0, angle);
|
2026-05-02 23:52:48 +08:00
|
|
|
|
// }
|
2026-05-04 17:21:52 +08:00
|
|
|
|
|
|
|
|
|
|
// // -------------------------
|
|
|
|
|
|
// // 获取发射点(给 GameMainPanel)
|
|
|
|
|
|
// // -------------------------
|
|
|
|
|
|
// public Vector2 GetBulletStartPos()
|
2026-05-02 23:52:48 +08:00
|
|
|
|
// {
|
2026-05-04 17:21:52 +08:00
|
|
|
|
// return currentTurret.GetBulletStartWorldPos();
|
2026-05-02 23:52:48 +08:00
|
|
|
|
// }
|
2026-05-04 17:21:52 +08:00
|
|
|
|
|
|
|
|
|
|
// // -------------------------
|
|
|
|
|
|
// // 金币消耗
|
|
|
|
|
|
// // -------------------------
|
|
|
|
|
|
// public bool ConsumeGold(int mul = 1)
|
2026-05-02 23:52:48 +08:00
|
|
|
|
// {
|
2026-05-04 17:21:52 +08:00
|
|
|
|
// long temp = goldNum - consumeGoldNum * mul;
|
|
|
|
|
|
// if (temp < 0) return false;
|
2026-05-02 23:52:48 +08:00
|
|
|
|
|
2026-05-04 17:21:52 +08:00
|
|
|
|
// goldNum = temp;
|
|
|
|
|
|
// tMP_GoldNum.text = goldNum.ToString();
|
|
|
|
|
|
// return true;
|
2026-05-02 23:52:48 +08:00
|
|
|
|
// }
|
|
|
|
|
|
|
2026-05-04 17:21:52 +08:00
|
|
|
|
// public void ChangeTurretAddConsumeNum(int n)
|
2026-05-02 23:52:48 +08:00
|
|
|
|
// {
|
|
|
|
|
|
// consumeGoldNum += n;
|
|
|
|
|
|
// tMP_TurretConsumeNum.text = consumeGoldNum.ToString();
|
|
|
|
|
|
// }
|
2026-05-04 17:21:52 +08:00
|
|
|
|
|
|
|
|
|
|
// public void ChangeTurretMinusConsumeNum(int n)
|
2026-05-02 23:52:48 +08:00
|
|
|
|
// {
|
|
|
|
|
|
// consumeGoldNum -= n;
|
|
|
|
|
|
// tMP_TurretConsumeNum.text = consumeGoldNum.ToString();
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
2026-05-04 17:21:52 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-02-03 11:35:19 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using TMPro;
|
|
|
|
|
|
using UnityEngine;
|
2026-03-09 09:25:01 +08:00
|
|
|
|
using UnityEngine.UI;
|
2026-02-03 11:35:19 +08:00
|
|
|
|
|
|
|
|
|
|
public class SitPosData : MonoBehaviour
|
|
|
|
|
|
{
|
2026-05-02 23:52:48 +08:00
|
|
|
|
// -------------------------
|
2026-05-04 17:21:52 +08:00
|
|
|
|
// 玩家基础信息
|
2026-05-02 23:52:48 +08:00
|
|
|
|
// -------------------------
|
2026-05-04 17:21:52 +08:00
|
|
|
|
[Header("玩家信息")]
|
2026-03-18 17:26:14 +08:00
|
|
|
|
public string user;
|
2026-02-03 11:35:19 +08:00
|
|
|
|
public int posID;
|
2026-05-02 23:52:48 +08:00
|
|
|
|
|
2026-03-27 15:18:35 +08:00
|
|
|
|
[Header("金币")]
|
2026-05-02 23:52:48 +08:00
|
|
|
|
public long goldNum;
|
|
|
|
|
|
public long consumeGoldNum;
|
2026-02-03 11:35:19 +08:00
|
|
|
|
public TextMeshProUGUI tMP_GoldNum;
|
2026-05-04 17:21:52 +08:00
|
|
|
|
public TextMeshProUGUI tMP_TurretConsumeNum;
|
2026-05-01 06:26:50 +08:00
|
|
|
|
|
2026-05-02 23:52:48 +08:00
|
|
|
|
// -------------------------
|
|
|
|
|
|
// 炮台管理
|
|
|
|
|
|
// -------------------------
|
2026-05-04 17:21:52 +08:00
|
|
|
|
[Header("炮台")]
|
2026-05-02 23:52:48 +08:00
|
|
|
|
public List<TurretData> list_Turrets = new List<TurretData>();
|
|
|
|
|
|
public Dictionary<string, TurretData> dic_Turrets = new Dictionary<string, TurretData>();
|
2026-05-04 17:21:52 +08:00
|
|
|
|
|
2026-02-03 11:35:19 +08:00
|
|
|
|
public int currentTurretIndex = 0;
|
2026-05-04 17:21:52 +08:00
|
|
|
|
public string currentTurretID = "";
|
2026-02-03 11:35:19 +08:00
|
|
|
|
public TurretData currentTurret;
|
2026-05-02 23:52:48 +08:00
|
|
|
|
|
|
|
|
|
|
// 状态机入口(GameMainPanel 调用)
|
|
|
|
|
|
public Action<TurretState> OnStateChange;
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------
|
|
|
|
|
|
// 炮台旋转
|
|
|
|
|
|
// -------------------------
|
2026-05-04 17:21:52 +08:00
|
|
|
|
[Header("炮台旋转")]
|
2026-05-02 23:52:48 +08:00
|
|
|
|
public Transform tra_CurrTurret;
|
|
|
|
|
|
public float currentAngle;
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------
|
|
|
|
|
|
// 锁定系统
|
|
|
|
|
|
// -------------------------
|
2026-05-04 17:21:52 +08:00
|
|
|
|
[Header("锁定系统")]
|
2026-03-09 09:25:01 +08:00
|
|
|
|
public MonsterContral monCotl_Lock;
|
2026-05-01 06:26:50 +08:00
|
|
|
|
public Transform monCotl_Lock_Position;
|
2026-05-04 17:21:52 +08:00
|
|
|
|
public bool isLock = false;
|
2026-03-18 17:26:14 +08:00
|
|
|
|
public GameObject lockFX;
|
2026-02-03 11:35:19 +08:00
|
|
|
|
|
2026-05-02 23:52:48 +08:00
|
|
|
|
// -------------------------
|
|
|
|
|
|
// UI
|
|
|
|
|
|
// -------------------------
|
2026-05-04 17:21:52 +08:00
|
|
|
|
[Header("UI")]
|
2026-05-02 23:52:48 +08:00
|
|
|
|
public Button btn_TurretAdd;
|
|
|
|
|
|
public Button btn_TurretMinus;
|
2026-02-09 10:44:38 +08:00
|
|
|
|
public GameObject changeTurretList;
|
2026-03-27 15:18:35 +08:00
|
|
|
|
|
2026-05-02 23:52:48 +08:00
|
|
|
|
private void Awake()
|
2026-02-03 11:35:19 +08:00
|
|
|
|
{
|
2026-05-04 17:21:52 +08:00
|
|
|
|
// 构建字典
|
2026-05-02 23:52:48 +08:00
|
|
|
|
dic_Turrets = list_Turrets.ToDictionary(t => t.turretID);
|
2026-05-01 06:26:50 +08:00
|
|
|
|
|
2026-05-04 17:21:52 +08:00
|
|
|
|
// 炮台倍率按钮
|
2026-05-02 23:52:48 +08:00
|
|
|
|
btn_TurretAdd.onClick.AddListener(() => ChangeTurretAddConsumeNum(1000));
|
|
|
|
|
|
btn_TurretMinus.onClick.AddListener(() => ChangeTurretMinusConsumeNum(1000));
|
2026-02-09 10:44:38 +08:00
|
|
|
|
}
|
2026-05-02 23:52:48 +08:00
|
|
|
|
|
|
|
|
|
|
// -------------------------
|
|
|
|
|
|
// 切换炮台
|
|
|
|
|
|
// -------------------------
|
|
|
|
|
|
public void ChangeTurret(int index)
|
2026-02-09 10:44:38 +08:00
|
|
|
|
{
|
2026-05-04 17:21:52 +08:00
|
|
|
|
// 关闭旧炮台
|
2026-02-03 11:35:19 +08:00
|
|
|
|
if (currentTurret != null)
|
|
|
|
|
|
currentTurret.gameObject.SetActive(false);
|
2026-05-02 23:52:48 +08:00
|
|
|
|
|
2026-05-04 17:21:52 +08:00
|
|
|
|
// 计算新索引
|
2026-05-02 23:52:48 +08:00
|
|
|
|
currentTurretIndex = Mathf.Clamp(index, 0, list_Turrets.Count - 1);
|
2026-05-04 17:21:52 +08:00
|
|
|
|
|
|
|
|
|
|
// 获取新炮台
|
2026-05-02 23:52:48 +08:00
|
|
|
|
currentTurret = list_Turrets[currentTurretIndex];
|
2026-05-04 17:21:52 +08:00
|
|
|
|
currentTurretID = currentTurret.turretID;
|
2026-02-03 11:35:19 +08:00
|
|
|
|
currentTurret.gameObject.SetActive(true);
|
|
|
|
|
|
|
2026-05-02 23:52:48 +08:00
|
|
|
|
// 绑定状态机入口
|
|
|
|
|
|
OnStateChange = currentTurret.ChangeState;
|
2026-02-03 11:35:19 +08:00
|
|
|
|
|
2026-05-02 23:52:48 +08:00
|
|
|
|
// 缓存旋转点
|
|
|
|
|
|
tra_CurrTurret = currentTurret.transform.GetChild(0);
|
2026-05-18 18:39:11 +08:00
|
|
|
|
if (CreateFishManager.Instance.currGameType != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
// 如果当前处于狂暴状态,切换炮台后也要继续倍速
|
|
|
|
|
|
bool frenzy = CreateFishManager.Instance.currGameType.isFrenzy;
|
|
|
|
|
|
currentTurret.SetFrenzy(frenzy);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-02-03 11:35:19 +08:00
|
|
|
|
}
|
2026-05-02 23:52:48 +08:00
|
|
|
|
|
|
|
|
|
|
// -------------------------
|
|
|
|
|
|
// 切换状态(GameMainPanel 调用)
|
|
|
|
|
|
// -------------------------
|
|
|
|
|
|
public void ChangeState(TurretState state)
|
2026-02-03 11:35:19 +08:00
|
|
|
|
{
|
2026-05-02 23:52:48 +08:00
|
|
|
|
OnStateChange?.Invoke(state);
|
2026-05-01 06:26:50 +08:00
|
|
|
|
}
|
2026-05-02 23:52:48 +08:00
|
|
|
|
|
|
|
|
|
|
// -------------------------
|
2026-05-04 17:21:52 +08:00
|
|
|
|
// 炮台旋转(GameMainPanel 调用)
|
2026-05-02 23:52:48 +08:00
|
|
|
|
// -------------------------
|
|
|
|
|
|
public void SetRotation(float angle)
|
|
|
|
|
|
{
|
|
|
|
|
|
currentAngle = angle;
|
2026-05-04 17:21:52 +08:00
|
|
|
|
if (tra_CurrTurret != null)
|
|
|
|
|
|
tra_CurrTurret.rotation = Quaternion.Euler(0, 0, angle);
|
2026-05-02 23:52:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------
|
|
|
|
|
|
// 获取发射点(给 GameMainPanel)
|
|
|
|
|
|
// -------------------------
|
|
|
|
|
|
public Vector2 GetBulletStartPos()
|
|
|
|
|
|
{
|
|
|
|
|
|
return currentTurret.GetBulletStartWorldPos();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------
|
|
|
|
|
|
// 金币消耗
|
|
|
|
|
|
// -------------------------
|
|
|
|
|
|
public bool ConsumeGold(int mul = 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
long temp = goldNum - consumeGoldNum * mul;
|
|
|
|
|
|
if (temp < 0) return false;
|
|
|
|
|
|
|
|
|
|
|
|
goldNum = temp;
|
|
|
|
|
|
tMP_GoldNum.text = goldNum.ToString();
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void ChangeTurretAddConsumeNum(int n)
|
2026-05-01 06:26:50 +08:00
|
|
|
|
{
|
|
|
|
|
|
consumeGoldNum += n;
|
|
|
|
|
|
tMP_TurretConsumeNum.text = consumeGoldNum.ToString();
|
|
|
|
|
|
}
|
2026-05-02 23:52:48 +08:00
|
|
|
|
|
|
|
|
|
|
public void ChangeTurretMinusConsumeNum(int n)
|
2026-05-01 06:26:50 +08:00
|
|
|
|
{
|
|
|
|
|
|
consumeGoldNum -= n;
|
|
|
|
|
|
tMP_TurretConsumeNum.text = consumeGoldNum.ToString();
|
2026-02-03 11:35:19 +08:00
|
|
|
|
}
|
2026-05-04 17:21:52 +08:00
|
|
|
|
|
|
|
|
|
|
// -------------------------
|
|
|
|
|
|
// 锁定系统(本地)
|
|
|
|
|
|
// -------------------------
|
|
|
|
|
|
public void SetLockTarget(MonsterContral monster, Transform hitPos)
|
|
|
|
|
|
{
|
|
|
|
|
|
monCotl_Lock = monster;
|
|
|
|
|
|
monCotl_Lock_Position = hitPos;
|
|
|
|
|
|
isLock = monster != null;
|
|
|
|
|
|
|
|
|
|
|
|
lockFX.SetActive(isLock);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void ClearLock()
|
|
|
|
|
|
{
|
|
|
|
|
|
monCotl_Lock = null;
|
|
|
|
|
|
monCotl_Lock_Position = null;
|
|
|
|
|
|
isLock = false;
|
|
|
|
|
|
|
|
|
|
|
|
lockFX.SetActive(false);
|
|
|
|
|
|
}
|
2026-02-03 11:35:19 +08:00
|
|
|
|
}
|
2026-05-04 17:21:52 +08:00
|
|
|
|
|