// Check to see if Player is still colliding with box collider void OnTriggerStay2D(Collider2D collider) { // Check to see if collision with Health if (collider.tag == "Health") { //Start subtracting from time Health_Count_Down -= Time.deltaTime; //check if count down is below zero if (Health_Count_Down <= 0) { //Damage players health Player.Health = Player.Health - (10 * Player.Level); //Play sound for damage health Sound_Controller.On_Health_Damage(); UI_Manager.Instance.UpdateHealth(); // Reset Count down timer Health_Count_Down = 1; } } // Check to see if collision with Level Complete if (collider.tag == "Level_Complete") { // Load Win Scene Application.LoadLevel("You_Won"); } }
// Use this for initialization void Start() { //Get and store a reference to the Rigidbody2D component so that we can access it. rb2d = GetComponent <Rigidbody2D>(); //Scene内のスクリプト、GameManagerを取得 gamemanager = GameObject.Find("GameManager").GetComponent <GameManager>(); Save = GameObject.FindGameObjectWithTag("Save"); SC = Save.GetComponent <Sound_Controller>(); audio_source = GetComponents <AudioSource>(); text_e = Canvas_E.GetComponentInChildren <Text>(); text_e.text = "";//消しとく //マシン性能の設定 Machine_Parameter MP = Save.GetComponent <Machine_Parameter>(); acceleration = MP.acceleration; limmit_speed = MP.limmit_speed; mass = MP.mass; power = MP.power; friction = MP.friction; dash = MP.dash; //ここで見た目(sprite)を変える //SE audio_source[1].Pause(); //Androidで傾きを使う Input.gyro.enabled = true; }
// Starts the background music playing void Background_Music() { //check to see if music is already playing if (Music_Playing) { Sound_Controller.On_Background_music(); //set music_playing to false to stop track starting again Music_Playing = false; } }
//Plays Music void Background_Music() { // checkt to see if music is playing if (music_playing) { // Plays music Sound_Controller.On_Background_music(); // Stops music from playing music_playing = false; } }
// Use this for initialization void Start() { ST = GameObject.FindGameObjectWithTag("Save").GetComponent <SceneTransition>(); SL = GameObject.FindGameObjectWithTag("Save").GetComponent <SaveLoad>(); SC = GameObject.FindGameObjectWithTag("Save").GetComponent <Sound_Controller>(); //if(ConfigPara.start_number != 0) //{ //} //else //{ // SL.Save();//一回目の起動時にセーブファイルを作成 //} SL.Load();//タイトルでロード }
// Use this for initialization void Start() { Save = GameObject.FindGameObjectWithTag("Save"); ST = Save.GetComponent <SceneTransition>(); SL = Save.GetComponent <SaveLoad>(); SC = GameObject.FindGameObjectWithTag("Save").GetComponent <Sound_Controller>(); Player = GameObject.FindGameObjectWithTag("Player"); Player.transform.position = PlayerPara.start_position; //テキストオブジェクトをセットする TextUtility.SetTextObject(countText, timeText, winText, loseText, gameoverText); //Initialize count to zero. Variable.count = 0; if (!Utility.isCity) { if (ConfigPara.language != ConfigPara.Language.Japanese) { TextUtility.SetText(TextUtility.TextName.count, "Jewelry " + Variable.count.ToString()); } else { TextUtility.SetText(TextUtility.TextName.count, "宝石 " + Variable.count.ToString()); } } Variable.time = CommonValue.limit_time; if (ConfigPara.language != ConfigPara.Language.Japanese) { TextUtility.SetText(TextUtility.TextName.time, "Time " + ((int)Variable.time).ToString()); } else { TextUtility.SetText(TextUtility.TextName.time, "残り時間 " + ((int)Variable.time).ToString()); } //Initialze winText to a blank string since we haven't won yet at beginning. TextUtility.SetText(TextUtility.TextName.win, ""); //TextUtility.SetText(TextUtility.TextName.lose, ""); TextUtility.SetText(TextUtility.TextName.gameover, ""); //最初に全オブジェクトを止めとく Time.timeScale = 0; }
// Check to see if player had entered a trigger void OnTriggerEnter2D(Collider2D collider) { // Check to see if collision with Health if (collider.tag == "Health") { Player.Health = Player.Health - (10 * Player.Level); Health_Count_Down = 1; //Play sound for health damage Sound_Controller.On_Health_Damage(); UI_Manager.Instance.UpdateHealth(); } // Check to see if collision with Speed if (collider.tag == "Speed") { //Check to see player speed is not a maximum for Level if (Player.Movement_Speed < (15 * Player.Level)) { Player.Movement_Speed = Player.Movement_Speed + (5 * Player.Level); //Play speed up sound Sound_Controller.On_Speed_Up(); UI_Manager.Instance.UpdateSpeed(); Debug.Log("Speed Tag Tester"); } } // Check to see if collision with Freeze if (collider.tag == "Freeze") { Player.Movement_Speed = 0; //Play Freeze sound effect Sound_Controller.On_Freeze(); Debug.Log(" Its freezing in here"); } // Check to see if collision with Level_Up if (collider.tag == "Level_Up") { // Level up the Player Player.Level = Player.Level + 1; Player.Level_Up = true; } }
// Use this for initialization void Start() { ST = GameObject.FindGameObjectWithTag("Save").GetComponent <SceneTransition>(); SC = GameObject.FindGameObjectWithTag("Save").GetComponent <Sound_Controller>(); HiScore.text = Variable.Score.ToString(); }
private void Awake() { sound = GetComponent <Sound_Controller>(); }
// Use this for initialization void Start() { //Gives the attribues to the singleton Instance = this; }
void Start() { SC = GetComponent <Sound_Controller>(); SL = GetComponent <SaveLoad>(); }