private void Awake() { property = GetComponent <ShipProperty>(); bulletManager = GameObject.Find("BulletManager"); bulletPool = bulletManager.GetComponent <BulletPool>(); dirIdx = 0; }
private bool isGameOver = false; //标识,保证游戏结束时的相关行为只执行一次 // Start is called before the first frame update void Start() { Cursor.visible = false; //禁用鼠标光标 if (gm == null) //静态游戏管理器初始化 { gm = GetComponent <GameManager>(); } if (player == null) //获取场景中的游戏主角 { player = GameObject.FindGameObjectWithTag("Player"); } gm.gameState = GameState.Playing; //游戏状态设置为游戏进行中 currentScore = 0; //当前得分初始化为0 startTime = Time.time; //记录场景加载的时刻 shipProperty = player.GetComponent <ShipProperty>(); //获取玩家生命值组件,并初始化玩家生命值与HealthSlider参数 currentScore = 0; //当前得分初始化为0 shipProperty = player.GetComponent <ShipProperty>(); if (shipProperty) { healthSlider.maxValue = shipProperty.startShipHealth; healthSlider.minValue = 0; healthSlider.value = shipProperty.startShipHealth; } playingCanvas.SetActive(true); //启用游戏进行中Canvas gameResultCanvas.SetActive(false); //禁用游戏结果Canvas }
// Use this for initialization void Start() { curPosition = Vector3.zero; beforePosition = Vector3.zero; shipProperty = GetComponent <ShipProperty>(); }
void Start() { shipProperty = player.GetComponent <ShipProperty>(); idleCanvas.gameObject.SetActive(true); LoadBestScore(); highScore.text = "Best Score:" + bestScore; playCanvas.gameObject.SetActive(false); //player.SetActive(false); enemy.SetActive(false); particle.SetActive(false); bullet.SetActive(false); }
// Use this for initialization void Start() { shipProperty = GetComponent <ShipProperty>(); }
private void Start() { shipproperty = GetComponentInParent <ShipProperty>(); //distance = ship.shipShootingRange; }
//Start is called before the first frame update void Start() { shipProperty = GetComponentInChildren <ShipProperty>(); collider = GetComponent <Collider>(); }