public void InitUIControl() { if (!GameController.GetSceneName().Equals("Farm")) { return; } userInterface = GameObject.Find("UserInterface").GetComponent <FarmUI>(); joyStick = GameObject.Find("VCAnalogJoystick").GetComponent <VCAnalogJoystickBase>(); cameraControl = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraController>(); playerGO = GameObject.Find("Player"); movement = playerGO.GetComponent <Movement>(); }
// Initialization of new game private void LoadGame() { // Else load player data from file if (GameController.Instance().loadPlayer) { // Loading from file & spawning cows by looping through loaded list of cows GameController.Instance().Load(); foreach (Cow cow in GameController.Instance().cows) { GetRandomPos(); // Using location variables to spawn cows & resetting current scene then spawn cow.currScene = GameController.GetSceneName(); if (CowMaker.SpawnCow(cow, Random.Range(farmTopLeftPos.x, farmBottomRightPos.x), Random.Range(farmTopLeftPos.y, farmBottomRightPos.y), Vector3.zero) == 1) { cow.cowController.Wait(); } } } }
public static Cow GenerateCow() { // Generate new cow from random selection int cowGen = Random.Range(1, 6); string cowType = "Angus"; switch (cowGen) { case 1: cowType = "Angus"; break; case 2: cowType = "Brangus"; break; case 3: cowType = "Charolais"; break; case 4: cowType = "Hereford"; break; case 5: cowType = "Holstein Friesian"; break; case 6: cowType = "Shorthorn"; break; } // Create new instance with random selection, then returning the cow instance Cow cow = new Cow(cowType + " - Breed", Random.Range(1, 15), cowType, Random.Range(1, 10), Random.Range(5, 100), true, true, Random.Range(150, 400), GameController.GetSceneName()); return(cow); }