void Start() { Button btn; if (null != m_next_level_button) { btn = m_next_level_button.GetComponent <Button>(); btn.onClick.AddListener(on_next_level_button_click); } if (null != m_replay_button) { btn = m_replay_button.GetComponent <Button>(); btn.onClick.AddListener(on_replay_button_click); } if (null != m_quit_button) { btn = m_quit_button.GetComponent <Button>(); btn.onClick.AddListener(on_quit_button_click); } if (null != m_return_button) { btn = m_return_button.GetComponent <Button>(); btn.onClick.AddListener(on_return_button_click); } // GameObject score_center_go = GameObject.Find("ScoreCenter"); // ScoreCenter score_center = score_center_go.AddComponent<ScoreCenter>(); m_highest_score.set_score(ScoreCenter.instance().HighestScore); m_highest_combo_hits.set_score(ScoreCenter.instance().HighestComboHits); }
void on_replay_button_click() { ScoreCenter.instance().clear_score(); ScoreCenter.instance().clear_combo_hit_count(); m_scene_switcher.m_scene_name = m_replay_scene_name;// StartCoroutine(m_scene_switcher.LoadYourAsyncScene()); }
void OnTriggerExit2D(Collider2D col) { if (!col.gameObject.CompareTag("Note")) { return; } MyNote mynote = col.gameObject.GetComponent <MyNote>(); remove_mynote(mynote); if (!mynote.m_is_hit) { ScoreCenter.instance().clear_combo_hit_count(); // on_hit_note(mynote); } }
// int score = 0; void on_hit_note(MyNote mynote) { remove_mynote(mynote); // Debug.Log( "on_hit_note : " + (score++) ); // animation // add score ScoreCenter.instance().add_score(1); m_score_ui.set_score(ScoreCenter.instance().Score); ScoreCenter.instance().add_combo_hit_count(1); m_combo_hit_ui.set_score(ScoreCenter.instance().ComboHitCount); // destroy gameobject Destroy(mynote.gameObject); mynote.m_note.m_gameobject = null; m_sprite_index = 0; // if( null != m_animator ) // { // m_animator.SetInteger( "action_state", MyConst.ACTION_STATE_HIT ); // } }