float BariaKyori = 0.8f;//バリアを張るとき、プレイヤーとバリアとの距離 // Start is called before the first frame update void Start() { Core = this.transform.Find("Core").gameObject.GetComponent <SpriteRenderer>(); Core.color = Color.green;//色を緑(通常状態) Rigidbody2D = this.GetComponent <Rigidbody2D>(); audio_script = GameObject.Find("Audio_Matome").GetComponent <Audio>(); switch (SceneManager.GetActiveScene().name) { case "ScoreAttack": this.gameObject.transform.position = new Vector2(-2, -3); //初期位置 matome = GameObject.Find("UI_Ground").GetComponent <Matome>(); Now_ScoreAttack = true; Make_Wall(); //初期でバリアを張る break; case "TimeAttack": this.gameObject.transform.position = new Vector2(0, -2); //初期位置 matome = GameObject.Find("UI_Ground").GetComponent <Matome>(); break; case "Title": this.gameObject.transform.position = new Vector2(0, -2); //初期位置 break; } }
bool Game_Now = false;//今のシーンがTitleかどうか(false=タイトル,true=それ以外) // Start is called before the first frame update void Start() { switch (SceneManager.GetActiveScene().name) //今のシーンがタイトル画面ではないなら { case "ScoreAttack": //スコアアタック matome = GameObject.Find("UI_Ground").GetComponent <Matome>(); Game_Now = true; break; case "TimeAttack": //タイムアタック matome = GameObject.Find("UI_Ground").GetComponent <Matome>(); break; } audio_script = GameObject.Find("Audio_Matome").GetComponent <Audio>(); Enemy_Spawn();//敵を出す }