public void TestMethod1() { Game test = new Game(); test.RandomList(10, 30); OnePlayer test1 = new OnePlayer(); }
public Game() { InitializeComponent(); //start a game //MAKE THIS RESPOND TO THE USER SAYING THEY WANT TO START A GAME playerMovement = new OnePlayer(); currentPlayer = new Player(ClientRectangle, playerMovement); currentGame = new GameBoard(ClientRectangle, currentPlayer); }
// Use this for initialization void Start() { Instance = this; // Set margin by screen size if (((float)Screen.height / (float)Screen.width) < 1.7f) { marginLeft = 25f; marginRight = 25f; } else { marginLeft = 40f; marginRight = 40f; } marginTop = 150f; marginBottom = 25f; // Disable PanelChoice PanelChoice.SetActive(false); draw = gameObject.AddComponent <DrawNumber>(); btnScript = gameObject.AddComponent <ButtonPrefab>(); // Load Best Score of each level BestScoreLV_0 = PlayerPrefs.GetInt(saveBestScoreLV_0, 0); BestScoreLV_1 = PlayerPrefs.GetInt(saveBestScoreLV_1, 0); BestScoreLV_2 = PlayerPrefs.GetInt(saveBestScoreLV_2, 0); BestScoreLV_3 = PlayerPrefs.GetInt(saveBestScoreLV_3, 0); BestScoreLV_4 = PlayerPrefs.GetInt(saveBestScoreLV_4, 0); Gold = PlayerPrefs.GetInt(saveGold, 0); // Set time for each level if (PanelChoiceScript.Instance.Choice_Level == 0) { numberCount = 90; TimeLevel = 16; time = TimeLevel; } if (PanelChoiceScript.Instance.Choice_Level == 1) { numberCount = 100; TimeLevel = 16; time = TimeLevel; } if (PanelChoiceScript.Instance.Choice_Level == 2) { numberCount = 100; TimeLevel = 11; time = TimeLevel; } // Level 2 if (PanelChoiceScript.Instance.Choice_Level == 3) { numberCount = 100; TimeLevel = 501; time = TimeLevel; ImgClock.gameObject.SetActive(false); ImgClockLV3.gameObject.SetActive(true); TxttimeLV3.gameObject.SetActive(true); } // Level 4 Generate_ListRanDomNumber(); count = 0; if (PanelChoiceScript.Instance.Choice_Level == 4) { numberCount = 100; TxtcurrentNumber.text = ListRandomNumber[0].ToString(); TimeLevel = 16; time = TimeLevel; } runTime = true; resetTime = false; // Sound SoundClick = gameObject.AddComponent <AudioSource>(); SoundResult = gameObject.AddComponent <AudioSource>(); SoundResult100 = gameObject.AddComponent <AudioSource>(); isSoundON = UIManagerScript.Instance.isSoundON; isMusicON = UIManagerScript.Instance.isMusicON; AudioClip ClickAudioClip; ClickAudioClip = (AudioClip)Resources.Load("Audio/Click_Number1"); SoundClick.clip = ClickAudioClip; SoundClick.loop = false; AudioClip ResultAudioClip; ResultAudioClip = (AudioClip)Resources.Load("Audio/Result"); SoundResult.clip = ResultAudioClip; SoundResult.loop = false; AudioClip Result100AudioClip; Result100AudioClip = (AudioClip)Resources.Load("Audio/Winner"); SoundResult100.clip = Result100AudioClip; SoundResult100.loop = false; // Show numbers ShowListNumber(); }
////////////////////////////////////////////////////////////////////////// //Constructor: sets initial game size, creates a player ship, and connects // to matching player input //Notes: -MAKE SURE ONEPLAYER IS ACTING AS REFERENCE TYPE ////////////////////////////////////////////////////////////////////////// internal Player(Rectangle inClient, OnePlayer inMoves) { _currentGameSize = inClient; _ship = new Ship(new PointF(_currentGameSize.Width / 2, _currentGameSize.Height / 2)); _moves = inMoves; }