feat(gameplay): 添加建筑系统和改进摄像机控制 - 移除人类士兵数据资产文件,重构为建筑放置系统 - 在CharacterData中添加productionInterval和buildingCost字段用于建筑生产 - 实现CameraFollow脚本的完整重写,支持键盘WASD拖动、鼠标拖动、触摸拖动 - 添加摄像机缩放功能,支持上下键和触摸双指缩放 - 更新Projecttile.cs以同时处理单位和建筑目标的伤害检测 - 修改SummonCardButton从法力值召唤改为金币建筑放置模式 - 在UnitBase.cs中更新攻击逻辑以支持对建筑造成伤害 - 升级WorldHealthBar以显示建筑生产进度和更好的缩放补偿 - 修复MainCharacterDebugMovement移除键盘移动输入冲突 - 更新包管理器中的codely.bridge版本从1.0.80到1.0.81 ```
37 lines
798 B
C#
37 lines
798 B
C#
using UnityEngine;
|
|
|
|
public class GoldMine : MonoBehaviour
|
|
{
|
|
[Header("产出配置")]
|
|
[Min(0)] public int goldPerTick = 5;
|
|
[Min(0.1f)] public float productionInterval = 3f;
|
|
|
|
private float timer;
|
|
private BuildingHealth buildingHealth;
|
|
|
|
private void Awake()
|
|
{
|
|
buildingHealth = GetComponent<BuildingHealth>();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (GoldSystem.Instance == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
timer += Time.deltaTime;
|
|
if (buildingHealth != null)
|
|
{
|
|
buildingHealth.SetProductionProgress(timer / productionInterval);
|
|
}
|
|
|
|
while (timer >= productionInterval)
|
|
{
|
|
timer -= productionInterval;
|
|
GoldSystem.Instance.AddGold(goldPerTick);
|
|
}
|
|
}
|
|
}
|