public void Menu() { m_State = ABGameState.Menu; m_Title.SetActive(false); m_Menu.SetActive(true); m_TimeCount = 0f; }
void ResetBall() { if (m_State == ABGameState.Start) { CreatePlayer(); m_State = ABGameState.Start; } }
public void StageEnd() { m_State = ABGameState.StageEnd; m_TimeText.text = "Stage Over"; foreach (var item in m_LevelObjects) { item.SetActive(false); } Destroy(m_CurLevel); Menu(); }
// Start is called before the first frame update public void BeforeStart() { m_Menu.SetActive(false); foreach (var item in m_LevelObjects) { item.SetActive(true); } m_CurLevel = Instantiate(m_LevelPrefabs[m_CurLevelNum - 1]); m_LevelText.text = m_LevelData.levels[m_CurLevelNum - 1].LevelName; m_BGMSource.clip = m_LevelData.levels[m_CurLevelNum - 1].LevelBGM; m_BGMSource.loop = true; m_BGMSource.Play(); m_State = ABGameState.Start; Invoke("DelayAction", 2); //this will happen after 2 seconds }
void CreatePlayer() { if (m_Players != null) { if (m_Players.Length > m_PlayerIdx) { GameObject ball = Instantiate(m_Players[m_PlayerIdx].gameObject, new Vector3(-6.5f, -0.1f, 0), Quaternion.identity); ball.GetComponent <SpringJoint2D>().connectedBody = m_SlingshotPos.GetComponent <Rigidbody2D>(); ball.GetComponent <Projectile>().m_DeactiveFunc += ResetBall; m_State = ABGameState.Start; m_PlayerIdx++; } else { m_State = ABGameState.StageEnd; } } }
public void Title() { m_State = ABGameState.Title; m_Title.SetActive(true); }