赞
踩
using UnityEngine;
using System.Collections;
using System.Collections.Generic;//引入泛型集合的命名空间
using UnityEngine.UI;//UI
using UnityEngine.SceneManagement;//场景管理器
using UnityEngine.EventSystems;//引入事件系统
namespace TowerDefenceTemplate
{
[System.Serializable]//系统序列化
public class Wave//敌方炮车波数
{
public Transform[] Waypoints;//路点数组
public Transform SpawnPoint;//产生敌方炮车的位置
public GameObject
EnemyPrefab,//敌方炮车预制体
ArrowPoint;//进攻方向预制体
public Sprite EnemiesIcon;//敌方炮车的图标
public int
Speed,//速率
Amount,//单波敌机总数
Interval,//时间间隔
Health,//血量
Damage,//伤害值
Award;//奖励金币
[HideInInspector]
public int Spawned;//已经产生的敌机数
}
public class GameManager : MonoBehaviour
{
private EventSystem _eventSystem;//实例化事件系统
[HideInInspector]
public UI_Controller _UI_Controller;//实例化UI_Controller
[HideInInspector]
public MainMenu mainMenu;
[HideInInspector]
public int CurrentWaveIndex;//定义当前波数的索引
[HideInInspector]
public List<GameObject>
SpawnedEnemies,//声明敌方炮车游戏对象的集合
BuiltTowers;//声明已建炮塔游戏对象的集合
private GameObject[] TowerPoints;//定义所有炮塔的信息
private float Timer;//计时器
private int BaseHealth = 100;//总血量
private bool GameEnded;//定义游戏是否结束
private Tower TowerToEdit;//实例化塔的对象
[HideInInspector]
public Dictionary<int, Bullet> BulletsPool;//定义炮弹池的键值对集合
[HideInInspector]
public Dictionary<int, Rocket> RocketsPool;//定义导弹池的键值对集合
private GameObject
RocketsPoolParent,//父导弹池
BulletsPoolParent,//父炮弹池
TempTower,//临时塔
TowerToBuild;//将要建造的塔
//UI
[HideInInspector]
public RectTransform BaseHealthBar;//矩形血条
[HideInInspector]
public Text//文本
MoneyMessage, //金币信息
WaveNumber,//当前波数
WaveUpperNumber,//总波数
MoneyText,//钱币
EnemiesLeftText,//没被摧毁的敌方炮车数量
WaveTimer,//波次倒计时
NameText,//名字
DamageText,//伤害值
RangeText,//检测范围
LevelText,//等级
UpgradeButtonText,//升级按钮
SellButtonText;//卖掉按钮
[HideInInspector]
public Image //图像
EnemiesIcon;//敌方炮车图标
[HideInInspector]
public Button ToMenuButton,//回到菜单
RestartButton;//重新开始本关卡
[HideInInspector]
public GameObject//定义游戏对象
RightPanel,//右侧小面板
PauseMenu,//
UpgradeButton;//升级按钮
[Header("Camera boundaries")]//摄相机范围(组件中的小标题)
public float X_Min;
public float X_Max;
public float Z_Min;
public float Z_Max;
public Wave[] Waves;//实例化波数
public int Money;//定义玩家的金币
[Header("Sounds")]//音效
public AudioSource BuildSound;//建塔音效
public AudioSource BaseDamageSound;//总血量减少时的音效
public AudioSource ErrorSound;//错误提示音效
public AudioSource ExplosionSound;//敌方炮车死亡时音效
public AudioSource LevelUpSound;//等级提升音效
public AudioSource LightGunShootSound;//光速炮射击音效
public AudioSource RicochetSound1;//炮弹弹跳音1
public AudioSource RicochetSound2;//炮弹弹跳音2
public AudioSource RicochetSound3;//炮弹弹跳音3
public AudioSource RocketLaunchSound;//导弹发射器射击音效
public AudioSource RocketExplosionSound;//导弹爆炸音效
public AudioSource FlameThrowerSound;//火焰喷射器射击音效
public AudioSource JeepSound;//吉普车行进音效
public AudioSource TankSound;//坦克行进音效
public AudioSource PlaneSound;//飞机行进音效
public AudioSource SellSound;//卖出炮塔音效
[Header("Prefabs")]
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。