private void createMainMenu() { startBtnRect = new Rect(55, 100, 180, 40); exitBtnRect = new Rect(55, 150, 180, 40); //layout start GUI.BeginGroup(new Rect(Screen.width / 2 - 150, 50, 300, 200)); //the menu background box GUI.Box(new Rect(0, 0, 300, 200), ""); //logo picture GUI.Label(new Rect(15, 10, 300, 68), logoTexture); ////////////////////////////////////// // Check for mouse clicking events. // ////////////////////////////////////// if (GUI.Button(startBtnRect, "Start game")) { MainMenuScript script = (MainMenuScript)GetComponent("MainMenuScript"); Debug.Log("Game starting..."); Application.LoadLevel("SpeculumMaximus"); script.enabled = false; } //quit button if (GUI.Button(exitBtnRect, "Quit")) { Application.Quit(); } //layout end GUI.EndGroup(); }
// Update is called once per frame public void add(string name) { if (Scores.ContainsKey(name)) { Scores[name]++; if (Scores[name] >= 10) { MainMenuScript menu = FindObjectOfType <MainMenuScript>(); menu.playerwin = name; winCanvas.SetActive(true); } } else { Scores.Add(name, 1); } Dictionary <string, int> sorted = new Dictionary <string, int>(); foreach (KeyValuePair <string, int> item in Scores.OrderByDescending(i => i.Value)) { sorted.Add(item.Key, item.Value); } Scores = sorted; }
public void checkIn() { foreach (HatchLocationMarker marker in _checkInnableMarkers) { marker.markVisited(); MainMenuScript.removeEntryFromIdMarkers(marker.Id, this); } _checkInnableMarkers.Clear(); foreach (BasicMarker marker in _checkInnableLocs.Keys) { bool unvisitedLocsUpdated = false; foreach (GenericLocation loc in _checkInnableLocs[marker]) { if (!unvisitedLocsUpdated) { MainMenuScript.removeEntryFromPlaceTypes(loc.LocationType, this); unvisitedLocsUpdated = true; } loc.markVisited(marker); } } _checkInnableLocs.Clear(); foreach (CheckInPlace place in PlacesToTake) { if (place.needToBeVisited()) { return; } } _hatchable = true; }
// Use this for initialization void Start() { menu = GameObject.FindObjectOfType <MainMenuScript>(); name = menu.playerName; input = this.GetComponent <Text>(); }
public static IEnumerator createEggForSelf(GameObject eggMenuItemPrefab, Transform eggMenuContentPanel, int imageIndex, string eggName = "") { if (SpatialClient2.single.isLoggedIn()) { List <SpatialMarker> markersAround = new List <SpatialMarker>(); CoroutineResponse markerResponse = new CoroutineResponse(); yield return(SpatialClient2.single.GetMarkersByDistance(Input.location.lastData.longitude, Input.location.lastData.latitude, UserMetadata.KAIJU_MARKER_RADIUS, true, markersAround, markerResponse)); // assign the hexadecimal representation of the egg creation number as custom part of id Debug.Log("hell yeah"); List <HatchLocationMarker> markersToTake = new List <HatchLocationMarker>(); List <GenericLocation> genericLocationsToTake = new List <GenericLocation>(); yield return(SpatialClient2.single.getLocationsForEgg(SpatialClient2.single.randomLocationFromMarkers(markersAround), markersToTake, genericLocationsToTake)); OwnedEgg egg = new OwnedEgg(imageIndex, SpatialClient2.single.newEggIdForSelf(), new LocationCombination(markersToTake, genericLocationsToTake), eggName, SpatialClient2.single.randomKaijuFromMarkers(markersAround)); yield return(egg.initializeSprite(new CoroutineResponse())); // sprite should already be there since we are coming from the egg screen, but just checking GameObject eggMenuItem = GameObject.Instantiate(eggMenuItemPrefab); eggMenuItem.transform.SetParent(eggMenuContentPanel, false); eggMenuItem.GetComponent <OwnEggMenuItem>().Egg = egg; // also updates the egg menu item's view MainMenuScript.addNewEggToCheckinnables(egg); yield return(SpatialClient2.single.addEggToSelf(egg)); Debug.Log("egg created"); } else { Debug.Log("tried to create egg while not logged in"); } }
// Use this for initialization void Start() { mainMenuScript = GameObject.FindObjectOfType <MainMenuScript>(); normalColor = GetComponent <Renderer>().material.color; thisCollider = GetComponent <Collider>(); thisCollider.isTrigger = true; }
void FlappyDies() { MainMenuScript.RequestInterstitial(); GameStateManager.GameState = GameState.Dead; DeathGUI.SetActive(true); GetComponent <AudioSource>().PlayOneShot(DeathAudioClip); }
void OnGUI() { if (!showMenu) { return; } if (GUI.Button(new Rect(40, 10, 150, 20), "Back to main menu")) { showMenu = false; MainMenu = GetComponent <MainMenuScript>(); MainMenu.OpenMenu("multiplayer"); } GUILayout.BeginArea(new Rect((Screen.width - 200) / 2, (Screen.height - 200) / 2, 200, 200)); //GUILayout.BeginArea(new Rect(0,0,Screen.width, Screen.height)); SaveLoad.Load(); GUI.Box(new Rect(0, 0, 400, 350), "Select Save File"); GUILayout.Space(10); GUILayout.Space(25); GUILayout.BeginHorizontal(); GUILayout.Space(25); GUILayout.EndHorizontal(); foreach (Game g in SaveLoad.savedGames) //displays list of cliacable saved games saved { if (GUILayout.Button(g.SaveName + " - " + g.Level)) { //Move on to game... Application.LoadLevel(g.Level); } } GUILayout.EndArea(); //Back to main menu }
void Start() { videoEnded = false; oneTimeEntrence = true; main = GameObject.Find("Main Camera").GetComponent <MainMenuScript>(); main.video = false; videoPlayer.isLooping = false; }
private void Awake() { txtDeviceName = transform.Find("Name").GetComponent <Text>(); txtDeviceMAC = transform.Find("MACAddress").GetComponent <Text>(); btn = transform.Find("Button").GetComponent <Button>(); btn.onClick.AddListener(BtnClicked); mainMenuScriptReference = GameObject.Find("Canvas/MainScreen").GetComponent <MainMenuScript>(); }
public void StartSim(MainMenuScript theMenuScript) { startInterval = Time.realtimeSinceStartup; menuScript = theMenuScript; rootsScript.RootMakeConfigList(); if (!InitConfigIsSolvable()) { menuScript.GoBack(); StartCoroutine(DisplayNotSolvableText()); } else { Update_H_Vals(rootsScript); // Checks to see if initial puzzle setup is solved if (rootsScript.config.SequenceEqual(goalList)) { StartCoroutine(DisplaypuzzleSolvedText()); } else { simulationStarted = true; // RECURSIVE FUNCTIONS TO FIND THE NODE bool solved = false; if (aStar) { solved = AStarSearchExpandNodes(theRootNode); } else { solved = BestFirstExpandNodes(theRootNode); } // SOMETIMES ASTAR RETURNS FALSE WHEN IT SHOULDN'T // THIS EXTRA CHECK COMBS THROUGH THE VISITED LIST FOR THE GOAL solved = HaveWeVisited(goalList); // DISPLAYS THE RIGHT MESSAGE if (solved) { StartCoroutine(DisplaypuzzleSolvedText()); } else if (callCount >= maxCalls) { DisplayMainLimitReachedText(); } else { DisplayTimedOutText(); } endInterval = Time.realtimeSinceStartup; runTimeText.color = new Color(255, 128, 0, 255); float totalTime = Mathf.Abs(startInterval - endInterval); runTimeText.text = totalTime.ToString("f3") + " seconds"; int totalNodes = visitedNodes.Count; nodesVisitedText.text = totalNodes.ToString(); OrganizeNodes(); DrawAllLines(theRootNode); } } }
// Init all the game states void initLevel() { // Init Cnavas gameCanvas.SetActive(true); winCanvas.SetActive(false); shareSucceedCanvas.SetActive(false); findEggCanvas.SetActive(false); editEggNameCanvas.SetActive(false); Debug.Log("Canvas finished"); // Init Reward score = 0; eggIndex = -1; eggName = ""; Debug.Log("REward f"); // Init Game States buildingDestroyedCount = 0; win = false; shareStatus = FacebookManager.ShareStatus.None; fallenPiecesCount = 0; // Shake Action shakeDetectionThreshold *= shakeDetectionThreshold; lowPassValue = Input.acceleration; Debug.Log("Shake f "); // To Be Used GameObjects shakeText = gameCanvas.transform.FindChild("ShakeText").gameObject; shakeText.SetActive(false); ground = GameObject.FindGameObjectWithTag("ground"); progressBar = gameCanvas.transform.FindChild("FullImage").gameObject; Debug.Log("Progress finished"); GetComponent <SpriteControl> ().deactivateColor(); MainMenuScript mainMenu = mainController.GetComponent <MainMenuScript> (); kaiju = GameObject.Find("Kaiju").gameObject; selectedKaiju = mainMenu.SelectedKaiju; if (selectedKaiju != null) { kaiju.GetComponent <MonsterCreator> (). setUpMonster(selectedKaiju.HeadType, selectedKaiju.HandType, selectedKaiju.BodyType, selectedKaiju.MonsterColor); } else { kaiju.GetComponent <MonsterCreator> (). setUpMonster(6, 1, 1, Color.white); } Debug.Log("Setup Kaiju"); StartCoroutine(closeDestroyText(2.0f)); }
void initCamera(CameraMode mode) { mainController = GameObject.Find("MainController").GetComponent <MainController>(); startCamera(); takingPhoto = false; CAMREADY = false; KaijuSelfieModel.SetActive(false); BuildingSelfieModel.SetActive(false); EggSelfieModel.SetActive(false); EggCheckinModel.SetActive(false); MainMenuScript mainMenu = mainController.gameObject.GetComponent <MainMenuScript> (); Debug.Log(mode); switch (mode) { case CameraMode.BuildingDestruction: BuildingSelfieModel.SetActive(true); Kaiju kaiju = mainMenu.SelectedKaiju; BuildingSelfieModel.GetComponent <MonsterCreator> ().setUpMonster(kaiju.HeadType, kaiju.HandType, kaiju.BodyType, kaiju.MonsterColor); break; case CameraMode.EggHatching: // TODO: get egg information from spatial EggSelfieModel.SetActive(true); Debug.Log(mainController.selectedEgg.Index); GameObject Egg = HatchingEggs [mainController.selectedEgg.Index - 1]; Egg.SetActive(true); GameObject kaijuHead = GameObject.Find("KaijuHead"); kaijuHead.SetActive(false); StartCoroutine(ShowKaijuHead(kaijuHead)); kaijuHead.GetComponent <SpriteRenderer> ().sprite = mainController.selectedEgg.KaijuEmbryo.HeadSprite; break; case CameraMode.Kaiju: KaijuSelfieModel.SetActive(true); Kaiju selectedKaiju = mainMenu.SelectedKaiju; KaijuSelfieModel.GetComponent <MonsterCreator> ().setUpMonster(selectedKaiju.HeadType, selectedKaiju.HandType, selectedKaiju.BodyType, selectedKaiju.MonsterColor); break; case CameraMode.EggCheckin: EggCheckinModel.SetActive(true); GameObject CheckinEgg = GameObject.Find("CheckinEgg"); CheckinEgg.GetComponent <SpriteRenderer> ().sprite = mainController.selectedEgg.Sprite; //CheckinEgg.transform.localScale = new Vector3 (873.0f / mainController.selectedEgg.Sprite.texture.width, 878.0f / mainController.selectedEgg.Sprite.texture.height); break; default: break; } uiCanvas.SetActive(false); camDisplayCanvas.SetActive(false); shareCanvas.SetActive(false); }
public override void OnClientError(NetworkConnection conn, int errorCode) { MainMenuScript canvas = GameObject.FindObjectOfType <MainMenuScript>(); if (canvas != null) { canvas.OnClientError(); } base.OnClientError(conn, errorCode); }
public override void OnClientDisconnect(NetworkConnection conn) { MainMenuScript canvas = GameObject.FindObjectOfType <MainMenuScript>(); if (canvas != null) { canvas.OnClientDisconnect(); } base.OnClientDisconnect(conn); }
public void LoadGame() { if (!MainMenuScript.GetNewGame()) { Vector3 pos = new Vector3(data.positions[0], data.positions[1], data.positions[2]); // List<int> itemList = data.items; // GameObject[] items = pickups.GetComponentsInChildren<GameObject>(true); player.transform.position = pos; player.GetComponent <PlayerHealth>().SetPlayerHealth(data.health); List <int> itemList = new List <int>(); itemList = data.items; Transform[] allItems = pickups.GetComponentsInChildren <Transform>(true); Transform[] items = new Transform[pickups.transform.childCount]; int index = 0; foreach (Transform i in allItems) { if (i.parent == pickups.transform) { items[index] = i; index++; i.gameObject.SetActive(true); } } foreach (Transform item in items) { // Debug.Log(item.gameObject.name); foreach (int itemId in itemList) { if (item.gameObject.GetComponent <Pickup>().GetId() == itemId) { player.GetComponent <PlayerPickup>().PickItem(item.gameObject); // Debug.Log("Da"); } // Debug.Log(item.gameObject.GetComponent<Pickup>().GetId()); } } foreach (Transform i in items) { i.gameObject.SetActive(false); } if (data.locked == false) { door.GetComponent <DoorScripts>().UnlockDoor(); door.GetComponent <DoorScripts>().getKey().SetActive(false); door.GetComponent <DoorScripts>().getAnimator().SetTrigger("Unlocked"); } } else { Vector3 pos = new Vector3(defaultData.positions[0], defaultData.positions[1], defaultData.positions[2]); player.transform.position = pos; player.GetComponent <PlayerHealth>().SetPlayerHealth(defaultData.health); } }
private void Awake() { if (instance != null) { Destroy(gameObject); } else { instance = this; } }
private void hidePreviousScreen() { if (_previousCanvas == null) { MainMenuScript.hideWebView(); } else { _previousCanvas.enabled = false; } }
private void GetMainMenuScript() { if (!mms) { GameObject mc = GameObject.Find("Menu Code"); if (mc) { mms = mc.GetComponent <MainMenuScript>(); } } }
private void showPreviousScreen() { if (_previousCanvas == null) { MainMenuScript.showWebView(); } else { _previousCanvas.enabled = true; } }
private void Awake() { if (instance == null) { instance = this; SceneManager.sceneLoaded += OnSceneLoaded; } else { Destroy(gameObject); } }
private void Start() { mainMenuScript = transform.parent.gameObject.GetComponent <MainMenuScript>(); // bind functions to buttons nextButton.onClick.AddListener(NextPod); previousButton.onClick.AddListener(PreviousPod); shopButton.onClick.AddListener(GoToShop); goButton.onClick.AddListener(Play); Refresh(); }
public void updateLeaderboard() { MainMenuScript.LoadData(); string temp = ""; for (int i = 0; i < 10; i++) { temp += "" + (i + 1) + ". " + scores[i] + "\n"; } highScores.text = temp; }
// Use this for initialization void Awake() { Instance = this; mainCamera = GameObject.Find("Main Camera"); ovrCamera = GameObject.Find("OVRCameraController"); psScript = GameObject.Find("PlayerSettings").GetComponent<PlayerSettingsScript>(); volNum = psScript.masterVolume; sfxNum = psScript.effectsVolume; UpdateSliders(); Screen.showCursor = false; lastX = Input.mousePosition.x; lastY = Input.mousePosition.y; }
public static void HandleSendMessage(Packet p) { string name, message; name = p.ReadString(); message = p.ReadString(); if (!GameMgr.Instance.game_started) { MainMenuScript menu = GameObject.Find("OrthoCamera").GetComponent <MainMenuScript>(); menu.AddMessage(name, message); current.SendPacketBroadCast(p); } }
void Awake() { SP = this; user = PlayerPrefs.GetString("playerName", ""); requirePlayerName = true; joinMenuScript = GetComponent<JoinMenuScript>() as JoinMenuScript; gameLobbyScript = GetComponent<GameLobbyScript>() as GameLobbyScript; multiplayerScript = GetComponent<MultiplayerMenuScript>() as MultiplayerMenuScript; OpenMenu("multiplayer"); }
private IEnumerator hatchEgg() { MessageController.single.displayWaitScreen(MainMenuScript.EggsCanvas); MainController.single.selectedEgg = _egg; yield return(_egg.KaijuEmbryo.initializeSprites(new CoroutineResponse())); MainMenuScript.addKaijuButton(_egg.KaijuEmbryo); MessageController.single.closeWaitScreen(false); MessageController.single.closeWaitScreen(false); yield return(SpatialClient2.single.hatchEgg(_egg)); MainController.single.goToPhoneCamera(PhoneImageController.CameraMode.EggHatching); Destroy(gameObject); }
void ReturnToMainMenu() { //applciation code for objects inside of the main menu scene Debug.Log("RETURN TO MAIN MENU METHOD"); if (Application.loadedLevelName == "Level 01") { Debug.Log("Applicaiton loaded level fromplayer shootig script"); MainMenuScript goToMain = shootHit.collider.GetComponent <MainMenuScript> (); if (goToMain) { mainmenuscript.MainMenuToggle = true; Debug.Log("GO TO MAIN MENU"); } } }
void Start() { Application.runInBackground = true; s_instance = this; player_pool = new PoolSystem <GameObject>(ResourcesLoader.LoadResources <GameObject>("Prefabs/Player_model"), 4); bomb_pool = new PoolSystem <GameObject>(ResourcesLoader.LoadResources <GameObject>("Prefabs/Bomb"), 100); pwr_up_pool = new PoolSystem <GameObject>(ResourcesLoader.LoadResources <GameObject>("Prefabs/PowerUp"), 100); hud = GameObject.Find("HUD").GetComponent <HUD>(); m_MainCamera = GameObject.Find("MainCamera"); mainMenu = GameObject.Find("OrthoCamera").GetComponent <MainMenuScript>(); mp = GameObject.Find("MusicPlayer").GetComponent <MusicPlayer>(); endmenu = GameObject.Find("EndMenu").GetComponent <EndMenu>(); baseRotation = m_MainCamera.transform.rotation; gravityStates = new Vector3[] { Vector3.up *const_gravity, Vector3.forward *const_gravity, Vector3.forward * -const_gravity, Vector3.right *const_gravity, Vector3.right * -const_gravity }; }
/// <summary> /// untuk ngecek jika ada save data atau tidak /// </summary> void CheckSaveSlot() { try { mms = GameObject.Find("MainMenuScript").GetComponent <MainMenuScript>(); for (int i = 0; i < saveSlotExist.Length; i++) { string txt = i.ToString(); string path = Application.persistentDataPath + "/player" + txt + ".savegame"; if (File.Exists(path)) { saveSlotExist[i] = true; mms.saveSlotText[i].text = "Exist"; } } } catch { //Debug.Log("no mainmenuscript"); } }
public void closeWaitScreen(bool showMapView) { if (_canvasesWaiting > 0) { _canvasesWaiting--; } if (_pleaseWaitCanvas.enabled && _canvasesWaiting == 0) { _pleaseWaitCanvas.enabled = false; if (showMapView) { MainMenuScript.showWebView(); } else { showPreviousScreen(); } } Debug.Log("Close Wait Screen" + _canvasesWaiting); }
private void OnPlayerHit() { if (!isInvincible) { isInvincible = true; Task.Factory.StartNew(async() => { await Task.Delay(bossAttributes.invincibilityCooldownMillis); isInvincible = false; }); bossAttributes.hitPoints--; if (bossAttributes.hitPoints <= 0) { Destroy(gameObject); GameData.hp = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerAttributes>().hp; // TODO: Load End-Level Scene MainMenuScript.RestartGame(); } } }
void Awake() { instance = this; // Allows us to access MainMenuScript from anywhere // (which is ok because there will only ever be one of them active at a time) }
void Start() { networkManager = GetComponent<NetworkManagerScript>(); mainMenu = GetComponent<MainMenuScript>(); gameManager = GetComponent<GameManagerScript>(); playerData = GetComponent<PlayerDataScript>(); menuManager = GetComponent<MenuManager>(); hud = GetComponent<HUDScript>(); chatRoom = GetComponent<ChatRoomScript>(); // column rects Horizontal start Vert Start Width Height firstCol = new Rect( 12, 50, Screen.width/3 - 18, Screen.height - 50); secCol = new Rect( Screen.width/3 + 6, 50, Screen.width/3 - 68, Screen.height - 50); thirdCol = new Rect( 2*Screen.width/3 - 44, 50, Screen.width/3 + 32, Screen.height - 50); //the list of teams, as strings List<Team> teams = Team.GetTeamList(); teamList = new string[teams.Count]; for(int x = 0; x < teams.Count; x++) { teamList[x] = teams[x].name; } }
// Use this for initialization void Start() { playUI = Object.FindObjectOfType<MainMenuScript>(); }
void Start() { networkManager = GetComponent<NetworkManagerScript>(); mainMenu = GetComponent<MainMenuScript>(); pause = GetComponent<PauseMenuScript>(); scoreMenu = GetComponent<ScoreMenuScript>(); chatRoom = GetComponent<ChatRoomScript>(); chatBoxColor = new Color(1,1,1,GameSettings.chatBoxOpacity); chatRect = new Rect(0, 100, 300, 400); }
// Use this for initialization void Start() { platformManager = GetComponent<PlatformManagerScript>(); networkManager = GetComponent<NetworkManagerScript>(); spawnManager = GetComponent<SpawnManagerScript>(); menuManager = GetComponent<MenuManager>(); lobby = GetComponent<GameLobbyScript>(); mainMenu = GetComponent<MainMenuScript>(); playerData = GetComponent<PlayerDataScript>(); gameIsActive = false; }
void Start() { networkManager = GetComponent<NetworkManagerScript>(); mainMenu = GetComponent<MainMenuScript>(); hud = GetComponent<HUDScript>(); pause = GetComponent<PauseMenuScript>(); }
// Use this for initialization void Start() { nextMenu = PauseMenuNextMenu.NONE; networkManager = GetComponent<NetworkManagerScript>(); gameManager = GetComponent<GameManagerScript>(); settings = GetComponent<SettingsMenu>(); mainMenu = GetComponent<MainMenuScript>(); lobby = GetComponent<GameLobbyScript>(); hud = GetComponent<HUDScript>(); }
void Start() { mainMenuScript = MainMenuScript.SP; MultiplayerFunctionScript.SP.SetHostListDelegate(FullHostListReceived); MultiplayerFunctionScript.SP.FetchHostList(); }
void Start() { firstGUI = true; scroll = 0; guin = GetComponent<GUINavigation>(); mms = GetComponent<MainMenuScript>(); }
void Start() { mainMenuScript = MainMenuScript.SP; }