// Use this for initialization void Start() { placedBlocks = new List <GameObject> (); timeLeft = build_time; groundDestination = new Vector2(0, -50f); // JF: Set up audiosources: // [0] background musics that loop // [1] sound effects that do not loop audioSource = GetComponent <AudioSource> (); if (!in_tutorial) { Invoke("PlayMusic", 3f); MiddleBanner.GetBanner().CreateBanner("Ready...", 4f); Invoke("SetBannerDisplay", 1.75f); } // Instantiating the players if (players.Count == 0) { players = new List <GameObject> (); foreach (PlayerInfo pi in GameManager.GetPlayerList()) { GameObject go = Instantiate <GameObject> (playerPrefab); go.GetComponent <Player> ().SetPlayerSettings(pi.input, pi.charSettings, pi.teamSettings); go.transform.position = new Vector3(UnityEngine.Random.Range(-25f, 25f), 10f, 0f); players.Add(go); } } }
void PlayMusic() { if (!in_tutorial) { MiddleBanner.GetBanner().ChangeText("GO!"); SFXManager.GetSFXManager().PlaySFX(SFX.AirHorn, 0.5f); begin_game = true; audioSource.clip = buildBgm; audioSource.loop = true; audioSource.Play(); } }
void CharacterUpdate() { // Return to the main menu if (InputManager.ActiveDevice.Action2.WasPressed && devices.ContainsKey(InputManager.ActiveDevice)) { foreach (CharacterSelectBar bar in charSelecters) { if (bar.GetDevice() == InputManager.ActiveDevice && bar.WaitingForPlayer()) { InitHomeScreen(); return; } } } bool ready = true; int team1 = 0; int team2 = 0; foreach (CharacterSelectBar bar in charSelecters) { if (!bar.IsReady() && !bar.WaitingForPlayer()) { ready = false; } else if (bar.IsReady()) { if (bar.GetSelectedTeam() == 1) { ++team1; } else if (bar.GetSelectedTeam() == 2) { ++team2; } } } if (ready) { ready = team1 > 0 && team2 > 0 && team1 + team2 > 1; } //if (ready >= 2 && team1 > 0 && team2 > 0) if (ready) { MiddleBanner.GetBanner().CreateBanner("Press A To Continue"); if (InputManager.ActiveDevice.Action1.WasPressed && devices.ContainsKey(InputManager.ActiveDevice)) { InitConfirmScreen(); MiddleBanner.GetBanner().DestroyBanner(); return; } } else { MiddleBanner.GetBanner().DestroyBanner(); } }
void SetBannerDisplay() { MiddleBanner.GetBanner().ChangeText("Set..."); }