private void SetupActors() { bool is2p = (player2Human || (PD.isDemo && PD.demoPlayers == 2)); float posx = is2p?3.0f:2.35f, posy = is2p?-1.2f:-0.8f, scale = is2p?0.22f:0.33f; actor1 = CreateActor(PD.GetPlayerSpritePath(PD.p1Char), new Vector3(-posx, posy), false, false, true); actor1.SetScale(scale); actor1.SetSprite(0); if (PD.gameType == PersistData.GT.Challenge) { actor1.Hide(); } if (PD.gameType == PersistData.GT.Campaign && Random.Range(0, 666) == 69) { actor2 = CreateActor("Doug", new Vector3(posx, posy), true, false, true); actor2.SetScale(scale); actor2.SetSprite(0); PD.p2Char = PersistData.C.Everyone; } else { actor2 = CreateActor(PD.GetPlayerSpritePath(PD.p2Char), new Vector3(posx, posy), true, false, true, PD.p1Char == PD.p2Char); actor2.SetScale(scale); actor2.SetSprite(0); if (PD.gameType == PersistData.GT.Campaign || PD.gameType == PersistData.GT.Challenge || PD.gameType == PersistData.GT.Training) { actor2.Hide(); } } }
public void Setup(bool won) { GetPersistData(); didP1Win = won; playeractor = CreateActor(PD.GetPlayerSpritePath(PD.p1Char), new Vector3(-2.1f, 0.2f), false, true, true); playeractor.SetScale(0.4f); opponentactor = CreateActor(PD.GetPlayerSpritePath(PD.p2Char), new Vector3(2.1f, 0.2f), true, true, true); opponentactor.SetScale(0.4f); tbox = (DialogContainer)gameObject.AddComponent("DialogContainer"); tbox.Setup(new Vector3(0.0f, -1.4f), true); isFirstLoad = true; PD.sounds.SetSoundVolume(PD.GetSaveData().savedOptions["vol_s"] / 350.0f); setText(); }
private void SetupCharacter() { SaveData sd = PD.GetSaveData(); PD.p2Char = (PersistData.C)sd.GetTitleScreenCharacter(); int winOffset = PD.GetPlayerSpriteStartIdx(PD.p2Char) * 3 + sd.getPlayerWinType(PD.GetPlayerSpritePath(PD.p2Char)); if (PD.p2Char == PersistData.C.White) { winOffset = 30; } else if (PD.p2Char == PersistData.C.September) { winOffset = 31; } Sprite[] sheet = Resources.LoadAll <Sprite>(SpritePaths.CharFullShots); bool onRight = System.Array.IndexOf(new int[] { 0, 3, 4, 7, 11, 13, 15, 16, 17, 19, 20, 22, 23, 24, 27, 29, 31 }, winOffset) >= 0; float xOffset = onRight?2.5f:-2.5f; if (PD.p2Char != PersistData.C.Null) { PD.sounds.SetVoiceAndPlay(SoundPaths.VoicePath + PD.GetPlayerSpritePath(PD.p2Char) + "/" + "083", 0); character = GetGameObject(new Vector3(xOffset, -0.5f), "A Player Is You", sheet[winOffset], true, "Zapper"); charTalker = new CutsceneChar(PD.GetPlayerSpritePath(PD.p2Char), character, null, 0, PD); if (PD.p2Char != PersistData.C.September && PD.p2Char != PersistData.C.White) { PD.sounds.SetMusicAndPlay(SoundPaths.M_Title_DerivPath + PD.GetPlayerSpritePath(PD.p2Char)); } else { PD.sounds.SetMusicAndPlay(SoundPaths.M_Title_DerivPath + "White"); if (PD.p2Char == PersistData.C.September) { PD.sounds.SetVoiceAndPlay(SoundPaths.VoicePath + "September/042", 0); } else { PD.sounds.SetVoiceAndPlay(SoundPaths.VoicePath + "White/032", 0); } } } else { PD.sounds.SetVoiceAndPlay(SoundPaths.NarratorPath + "001", 0); PD.sounds.SetMusicAndPlay(SoundPaths.M_Title_Default); } }
public void Start() { StateControllerInit(false); playeractor = CreateActor(PD.GetPlayerSpritePath(PD.p1Char), new Vector3(-5.15f, 1.0f)); PD.GetNextOpponent(); opponentactor = CreateActor(PD.GetPlayerSpritePath(PD.p2Char), new Vector3(5.15f, 1.0f), true); skipMenuIsUp = false; XmlNodeList dialogs = GetXMLHead("/" + playeractor.GetPath(PD.p1Char == PersistData.C.FuckingBalloon), "dialogs").SelectNodes("dialog"); XmlNode dialog = dialogs[PD.GetPuzzleLevel()]; dialogArr = dialog.SelectNodes("line"); rawInput = GetInputHandler(); dialogueBox = gameObject.AddComponent <DialogContainer>(); dialogueBox.Setup(new Vector3(0.0f, -3.5f)); bool isBossChar = PD.p1Char == PersistData.C.White || PD.p1Char == PersistData.C.September; curFrame = (!isBossChar && (PD.level == 6 || PD.level == 8))?0:2; StartFrame(curFrame); skipButtonSheet = Resources.LoadAll <Sprite>(SpritePaths.ShortButtons); skipButton = GetGameObject(new Vector3(8.3f, -4.75f), "Skip", skipButtonSheet[0], true, "Pause HUD Buttons"); FontData font = PD.mostCommonFont.Clone(); font.scale = 0.045f; XmlNode top = GetXMLHead(); skipText = GetMeshText(new Vector3(8.3f, -4.61f), GetXmlValue(top, "skip"), font).gameObject; skipText.renderer.sortingLayerName = "Pause HUD Text"; mouseObjects.Add(skipButton); mouseObjects.Add(skipText); skipMenu = GetGameObject(new Vector3(0.0f, 0.0f), "Skip Menu", Resources.Load <Sprite>(SpritePaths.CutsceneSkipBox), false, "HUDText"); string f = string.Format(GetXmlValue(top, "skipmessage"), "\r\n", PD.controller.GetFriendlyActionName(InputMethod.Action.launch), PD.controller.GetFriendlyActionName(InputMethod.Action.pause)); font.scale = 0.08f; font.layerName = "Reference"; skipMenuText = GetMeshText(new Vector3(0.0f, 0.5f), f, font); skipMenuText.text = new WritingWriter().GetWrappedString(skipMenuText, f, skipMenu.renderer.bounds.size); skipMenuText.gameObject.SetActive(false); skipMenu.SetActive(false); PD.sounds.SetSoundVolume(PD.GetSaveData().savedOptions["vol_s"] / 350.0f); }
private string GetPath() { if (!isTitleScreen) { if (isWinScreen) { return(PD.GetPlayerSpritePath(PD.p1Char, true)); } if (PD.gameType == PersistData.GT.Versus) { return(PD.GetPlayerSpritePath(Random.value > 0.5f?PD.p1Char:PD.p2Char, true)); } if (PD.gameType == PersistData.GT.QuickPlay) { return(PD.GetPlayerSpritePath(Random.value > 0.35f?PD.p1Char:PD.p2Char, true)); } } return(PD.GetPlayerSpritePath(PD.p2Char, true)); }
public void Start() { StateControllerInit(false); GameObject g = GameObject.Find("Confetti") as GameObject; particles = g.GetComponent <ParticleSystem>(); pars = new ParticleSystem.Particle[particles.maxParticles]; int p1Wins = 0, p2Wins = 0; for (int i = 0; i < PD.playerOneWonRound.Count; i++) { if (PD.playerOneWonRound[i]) { p1Wins++; } else { p2Wins++; } } PersistData.C winChar = p1Wins > p2Wins?PD.p1Char:PD.p2Char; PersistData.C loseChar = p1Wins < p2Wins?PD.p1Char:PD.p2Char; GetGameObject(Vector3.zero, "BG", Resources.Load <Sprite>(SpritePaths.BGPath + PD.GetPlayerSpritePath(p1Wins > p2Wins?PD.p1Char:PD.p2Char, true)), false, "BG0"); PD.sounds.SetMusicAndPlay(SoundPaths.M_Title_DerivPath + PD.GetPlayerSpritePath(winChar)); winner = CreateActor(PD.GetPlayerSpritePath(winChar), new Vector3(-2.06f, -0.5f)); winner.SetScale(0.4f).SetSprite(2, false).SetSortingLayer("BG1"); PD.sounds.SetVoiceAndPlay(SoundPaths.NarratorPath + (Random.value > 0.5f ? "039" : "040"), 0); int narratorIndex = 24 + (int)winChar; PD.sounds.QueueVoice(SoundPaths.NarratorPath + narratorIndex.ToString("d3")); int val = Random.Range(70, 76); PD.sounds.QueueVoice(SoundPaths.VoicePath + PD.GetPlayerSpritePath(winChar) + "/" + val.ToString("d3")); PD.sounds.SetSoundVolume(PD.GetSaveData().savedOptions["vol_s"] / 115.0f); loser = CreateActor(PD.GetPlayerSpritePath(loseChar), new Vector3(2.81f, -1.25f), true); loser.SetSprite(loser.loseFrame, false).SetScale(0.2f).SetSortingLayer("BG1").SetTint(new Color(0.5f, 0.5f, 0.5f)); GetGameObject(new Vector3(1.3f, 0.7f), "infoBox", Resources.Load <Sprite>(SpritePaths.DetailsBox)); System.Xml.XmlNode top = GetXMLHead(); FontData f = PD.mostCommonFont.Clone(); f.scale = 0.07f; float x = 1.3f; GetMeshText(new Vector3(x, 1.5f), string.Format(GetXmlValue(top, "winstatement"), p1Wins > p2Wins?1:2), f); x = 1.2f; f.align = TextAlignment.Right; f.anchor = TextAnchor.MiddleRight; f.scale = 0.035f; GetMeshText(new Vector3(x, 0.9f), GetXmlValue(top, "wins") + ":", f); GetMeshText(new Vector3(x, 0.65f), GetXmlValue(top, "losses") + ":", f); GetMeshText(new Vector3(x, 0.4f), GetXmlValue(top, "totaltime") + ":", f); GetMeshText(new Vector3(x, 0.15f), GetXmlValue(top, "p1score") + ":", f); GetMeshText(new Vector3(x, -0.1f), GetXmlValue(top, "p2score") + ":", f); x = 1.7f; f.align = TextAlignment.Left; f.anchor = TextAnchor.MiddleLeft; GetMeshText(new Vector3(x, 0.9f), Mathf.Max(p1Wins, p2Wins).ToString(), f); GetMeshText(new Vector3(x, 0.65f), Mathf.Min(p1Wins, p2Wins).ToString(), f); GetMeshText(new Vector3(x, 0.4f), new ScoreTextFormatter().ConvertSecondsToMinuteSecondFormat(PD.totalRoundTime), f); GetMeshText(new Vector3(x, 0.15f), PD.totalP1RoundScore.ToString(), f); GetMeshText(new Vector3(x, -0.1f), PD.totalP2RoundScore.ToString(), f); applauseTimer = Random.Range(200, 220); if (PD.gameType == PersistData.GT.Online) { FontData f2 = PD.mostCommonFont.Clone(); f.scale = 0.03f; Sprite[] beginSheet = Resources.LoadAll <Sprite>(SpritePaths.LongButtons); begin = GetGameObject(new Vector3(0.0f, -1.31f), "Again", beginSheet[0], true, "HUD"); beginText = GetMeshText(new Vector3(0.0f, -1.215f), string.Format(GetXmlValue(top, "again"), PD.GetP1InputName(InputMethod.KeyBinding.launch)), f2).gameObject; cancel = GetGameObject(new Vector3(0.0f, -1.7f), "Leave", beginSheet[0], true, "HUD"); cancelText = GetMeshText(new Vector3(0.0f, -1.61f), string.Format(GetXmlValue(top, "leave"), PD.GetP1InputName(InputMethod.KeyBinding.back)), f2).gameObject; roundsSheet = Resources.LoadAll <Sprite>(SpritePaths.RoundStateIcons); p1Ok = GetGameObject(new Vector3(-0.25f, -1f), "P1 Ready", roundsSheet[2], true, "HUD"); p2Ok = GetGameObject(new Vector3(0.25f, -1f), "P2 Ready", roundsSheet[2], true, "HUD"); isOnline = true; onlineState = 0; theyreReady = false; Callback_statsReceived = Callback <UserStatsReceived_t> .Create(OnGetUserStats); SteamUserStats.RequestCurrentStats(); SteamUserStats.RequestUserStats((CSteamID)PD.onlineOpponentId); didP1win = p1Wins > p2Wins; readyToEnd = false; wantToEnd = false; } else { isOnline = false; } }
public void Start() { StateControllerInit(false); GameObject g = GameObject.Find("Confetti") as GameObject; particles = g.GetComponent <ParticleSystem>(); pars = new ParticleSystem.Particle[particles.maxParticles]; int p1Wins = 0, p2Wins = 0; for (int i = 0; i < PD.playerOneWonRound.Count; i++) { if (PD.playerOneWonRound[i]) { p1Wins++; } else { p2Wins++; } } PersistData.C winChar = p1Wins > p2Wins?PD.p1Char:PD.p2Char; PersistData.C loseChar = p1Wins < p2Wins?PD.p1Char:PD.p2Char; GetGameObject(Vector3.zero, "BG", Resources.Load <Sprite>(SpritePaths.BGPath + PD.GetPlayerSpritePath(p1Wins > p2Wins?PD.p1Char:PD.p2Char, true)), false, "BG0"); PD.sounds.SetMusicAndPlay(SoundPaths.M_Title_DerivPath + PD.GetPlayerSpritePath(winChar)); winner = CreateActor(PD.GetPlayerSpritePath(winChar), new Vector3(-2.06f, -0.5f)); winner.SetScale(0.4f).SetSprite(2, false).SetSortingLayer("BG1"); PD.sounds.SetVoiceAndPlay(SoundPaths.NarratorPath + (Random.value > 0.5f ? "039" : "040"), 0); int narratorIndex = 24 + (int)winChar; PD.sounds.QueueVoice(SoundPaths.NarratorPath + narratorIndex.ToString("d3")); int val = Random.Range(70, 76); PD.sounds.QueueVoice(SoundPaths.VoicePath + PD.GetPlayerSpritePath(winChar) + "/" + val.ToString("d3")); PD.sounds.SetSoundVolume(PD.GetSaveData().savedOptions["vol_s"] / 115.0f); loser = CreateActor(PD.GetPlayerSpritePath(loseChar), new Vector3(2.81f, -1.25f), true); loser.SetSprite(loser.loseFrame, false).SetScale(0.2f).SetSortingLayer("BG1").SetTint(new Color(0.5f, 0.5f, 0.5f)); GetGameObject(new Vector3(1.3f, 0.7f), "infoBox", Resources.Load <Sprite>(SpritePaths.DetailsBox)); System.Xml.XmlNode top = GetXMLHead(); FontData f = PD.mostCommonFont.Clone(); f.scale = 0.07f; float x = 1.3f; GetMeshText(new Vector3(x, 1.5f), string.Format(GetXmlValue(top, "winstatement"), p1Wins > p2Wins?1:2), f); x = 1.2f; f.align = TextAlignment.Right; f.anchor = TextAnchor.MiddleRight; f.scale = 0.035f; GetMeshText(new Vector3(x, 0.9f), GetXmlValue(top, "wins") + ":", f); GetMeshText(new Vector3(x, 0.65f), GetXmlValue(top, "losses") + ":", f); GetMeshText(new Vector3(x, 0.4f), GetXmlValue(top, "totaltime") + ":", f); GetMeshText(new Vector3(x, 0.15f), GetXmlValue(top, "p1score") + ":", f); GetMeshText(new Vector3(x, -0.1f), GetXmlValue(top, "p2score") + ":", f); x = 1.7f; f.align = TextAlignment.Left; f.anchor = TextAnchor.MiddleLeft; GetMeshText(new Vector3(x, 0.9f), Mathf.Max(p1Wins, p2Wins).ToString(), f); GetMeshText(new Vector3(x, 0.65f), Mathf.Min(p1Wins, p2Wins).ToString(), f); GetMeshText(new Vector3(x, 0.4f), new ScoreTextFormatter().ConvertSecondsToMinuteSecondFormat(PD.totalRoundTime), f); GetMeshText(new Vector3(x, 0.15f), PD.totalP1RoundScore.ToString(), f); GetMeshText(new Vector3(x, -0.1f), PD.totalP2RoundScore.ToString(), f); applauseTimer = Random.Range(200, 220); }