private void Awake() { O2Controller = GetComponent <O2Controller>(); BoostController = GetComponent <BoostController>(); SmokeController = GetComponent <SmokeController>(); gotHome = false; speedAux = speed; }
void Awake() { timeAux = 0; totalTime = 0; Planet = GameObject.FindGameObjectsWithTag("Planet"); HomePlanet = GameObject.FindGameObjectsWithTag("HomePlanet"); OxygenPlanet = GameObject.FindGameObjectsWithTag("OxigenPlanet"); var list = new List <GameObject>(); list.AddRange(Planet); list.AddRange(HomePlanet); list.AddRange(OxygenPlanet); // ::: Call ToArray to convert List to array Planets = list.ToArray(); nearestPlanet = GetNearestPlanet(); boostEnabled = false; O2Controller = GetComponent <O2Controller>(); }
/// <summary> /// プレイヤーをスポーンさせる(ステージの読み込みが完了した後に実行) /// </summary> /// <param name="spawnPosition">スポーン座標</param> /// <param name="water">ステージの水位情報</param> /// <param name="oxygen">酸素ゲージスクリプト</param> /// <param name="loadStage">読み込むステージの情報</param> /// <param name="startRotation">スポーン時の向き</param> public void SpawnPlayer(Vector3 spawnPosition, WaterHi water, O2Controller oxygen, StageData loadStage, Vector3?startRotation = null) { // 酸素ゲージを取得 OxygenGauge = oxygen; // ステージデータを取得 LoadStageData = loadStage; // プレイヤーをスポーン Player = Instantiate(playerPrefab, spawnPosition, Quaternion.identity, transform); // プレイヤーの向きを設定 Vector3 rot = startRotation ?? Vector3.zero; Player.transform.localRotation = Quaternion.Euler(rot); // プレイヤーに水位情報を渡す Player.StageWater = water; // 敵情報を取得 GetEnemyInfo(water); }