public void create_shine_over_character(CharacterIndex aIndex, bool positive, float duration) { int index = aIndex.LevelIndex - 1; var shineImage = mManager.mCharacterBundleManager.get_image("SHINE"); FlatElementImage shine = new FlatElementImage(shineImage.Image, shineImage.Data.Size, 3); Vector3 targetPos = mCharacters[index].SoftPosition + new Vector3(0, shine.BoundingBox.height / 2 - 340, 0); shine.HardPosition = targetPos + new Vector3(0, 2000, 0); shine.SoftPosition = targetPos; shine.HardColor = positive ? GameConstants.UiYellow : GameConstants.UiRed; shine.PositionInterpolationMinLimit = 200; shine.ColorInterpolationMaxLimit = Mathf.Infinity; shine.ColorInterpolationMinLimit = 1f; mElement.Add(shine); mShineCleanup.Add(shine); TED.add_one_shot_event( delegate() { shine.SoftColor = GameConstants.UiWhiteTransparent; }, duration).then_one_shot( delegate() { mShineCleanup.Remove(shine); mElement.Remove(shine); shine.destroy(); }, 3); }
public override void Update() { mFlatCamera.update(Time.deltaTime); foreach (FlatElementBase e in mElement) { e.update(Time.deltaTime); } TED.update(Time.deltaTime); ModeNormalPlay.draw_render_texture(mRTCamera); if (!GameConstants.XB1) { if (mManager.mZigManager.DepthView.DepthTexture != null) { mDepthImage.set_new_texture(mManager.mZigManager.DepthView.DepthTexture, new Vector2(160, 120)); } } //TEST CODE FOR XB1 DEPTH/IMAGE DISPLAY CAN DELETE //mDepthImage.set_new_texture((mManager.mZigManager.ZgInterface as MicrosoftZig).mKinect.DepthTexture,new Vector2(160,120)); //if(mManager.mZigManager.ImageView.imageTexture != null) //mColorImage.set_new_texture((mManager.mZigManager.ZgInterface as MicrosoftZig).mColorImageRT,new Vector2(300,300)); /*Material mat2 = new Material(ManagerManager.Manager.mReferences.mXB1ClearShader); * mat2.SetTexture("_MainTex",(mManager.mZigManager.ZgInterface as MicrosoftZig).mKinect.LabelTexture); * mDepthImage.PrimaryGameObject.GetComponentInChildren<Renderer>().material = mat2; * * Material mat = new Material(ManagerManager.Manager.mReferences.mXB1KinectImageMaskingShader); * mat.SetTexture("_MainTex",(mManager.mZigManager.ZgInterface as MicrosoftZig).mKinect.ColorTexture); * mat.SetTexture("_AlphaTex",(mManager.mZigManager.ZgInterface as MicrosoftZig).mKinect.LabelTexture); * mColorImage.PrimaryGameObject.GetComponentInChildren<Renderer>().material = mat;*/ }
public void update() { foreach (FlatElementBase e in mElement) { e.update(Time.deltaTime); } TED.update(Time.deltaTime); }
public void update() { mFlatCamera.update(Time.deltaTime); foreach (FlatElementBase e in mElement) { e.update(Time.deltaTime); } TED.update(Time.deltaTime); mUnlockAnnouncer.update(); }
public void skip_grave() { if (mGraveCompleteCb != null && mGraveChain != null) { TED.remove_event(mGraveChain); mGraveCompleteCb(); mGraveChain = null; mGraveCompleteCb = null; } }
public void transition_to_PLAY() { GS = NormalPlayGameState.PREPLAY; TED.add_one_shot_event(delegate(){ GS = NormalPlayGameState.PLAY; }, GameConstants.preplayTime); //no target pose means we don't want a transparent body if (NGM.CurrentTargetPose == null) { mManager.mTransparentBodyManager.transition_character_out(true); } }
public void CUTSCENE_finished(NUPD.ChangeSet changes = null) { TED.add_one_shot_event( delegate() { mManager.mMusicManager.fade_out(3); //fadeout whataver is playing, either the cutscene music or the character music (which plays after cutscene music finishes //apply all the diff changes again (in case we skipped and tehy werent applied duringcutscene) if (changes != null) { foreach (var e in changes.Changes) { CharIndexContainerInt diffChanges = e.Changes; //string changeMsg = e.Description; foreach (CharacterIndex cchar in CharacterIndex.sAllCharacters) { if (diffChanges[cchar] != 0) { mManager.mGameManager.change_character_difficulty(cchar, diffChanges[cchar]); } } } } } , 0).then_one_shot( delegate() { if (CurrentPerformanceStat.Character.LevelIndex > 6) //if natural death :) { if (space_camp_final_exam()) { transition_to_ASTRONAUT(); } else { //natural death mInterfaceManager.set_for_DEATH(CurrentPerformanceStat.Character) .then_one_shot( delegate() { transition_to_TRANSITION_play(new CharacterIndex("999")); } , 0); } } else { transition_to_CHOICE(); } } , GameConstants.transitionToChoiceDelayTime); }
public void you_are_playing_as(string aName, float displayTime = 5) { ManagerManager.Log("you are " + aName); if (aName == "") //hard fix for bug. XboneAll will call this function a bunch of times with empty string for some reason { return; } if (mPlayingText != null && !mPlayingText.Destroyed) { mPlayingText.HardColor = GameConstants.UiWhiteTransparent; } aName = System.Text.RegularExpressions.Regex.Replace(aName, @"[^\u0020-\u007E]", "[]"); if (aName.Length > 70) { aName = aName.Substring(0, 70) + "..."; } NewMenuReferenceBehaviour refs = mManager.mNewRef; var title = construct_flat_image("START_PLAYER", 100); int fontSize = aName.Length > 22 ? 21 : 50; Mathf.Clamp(65 - aName.Length, 22, 50); mPlayingText = new FlatElementText(refs.genericFont, fontSize, aName, 101); title.HardPosition = mFlatCamera.get_point(.73f, -.80f); mPlayingText.HardPosition = title.HardPosition - new Vector3(0, 44, 0); title.HardColor = GameConstants.UiWhiteTransparent; mPlayingText.HardColor = GameConstants.UiBlueTransparent; title.SoftColor = GameConstants.UiWhite; mPlayingText.SoftColor = GameConstants.UiBlue; mElement.Add(title); mElement.Add(mPlayingText); var iamreallystupid = mPlayingText; TED.add_one_shot_event( delegate() { title.SoftColor = iamreallystupid.SoftColor = GameConstants.UiWhiteTransparent; }, displayTime).then_one_shot( delegate() { title.destroy(); iamreallystupid.destroy(); mElement.Remove(title); mElement.Remove(iamreallystupid); }, displayTime); }
//TODO move to sunset //this gets called after choosing //this also gets called when you die/finish the game //also called when you get to age 110 public void transition_to_TRANSITION_play(CharacterIndex aNextCharacter) { float gDiffDisplayDur = 4f; GS = NormalPlayGameState.TRANSITION; //TODO maybe play a sound "Too Easy" "Ok" "Hard" "That's Impossible!!" var diffPhrases = new string[] { GameStrings.GetString("MNPdiff1"), GameStrings.GetString("MNPdiff2"), GameStrings.GetString("MNPdiff3"), GameStrings.GetString("MNPdiff4") }; TED.add_event( aNextCharacter.LevelIndex < 7 //if not grave or age 110 ? mSunsetManager.low_skippable_text_bubble_event(diffPhrases [NGM.CharacterHelper.Characters [aNextCharacter].Difficulty], gDiffDisplayDur) : delegate(float aTime){ return(true); } ).then_one_shot( delegate() { if (aNextCharacter != CharacterIndex.sGrave) { mManager.mAssetLoader.new_load_character(aNextCharacter.StringIdentifier, mManager.mCharacterBundleManager); } else { //This can probably stay here //we just died, so add the last character we just played and set the sun //normally this will get called right after you make a choice but if we're here that meeans we didn't make a choice because we died mSunsetManager.add_character(NGM.CurrentCharacterLoader.Character, !CurrentPerformanceStat.BadPerformance, false); mSunsetManager.set_sun(); slide_image(mFlatCamera, null, mSunsetImage, false, false); if (NGM.CurrentCharacterIndex == CharacterIndex.sOneHundred) { mSunsetManager.ShowBackground = false; } transition_to_GRAVE(); } } ); }
public void transition_to_ASTRONAUT() { mSunsetManager.add_character(NGM.CurrentCharacterLoader.Character, !CurrentPerformanceStat.BadPerformance); slide_image(mFlatCamera, null, mSunsetImage, false); TED.add_event( delegate(float aTime){ //mSunsetManager.fade_characters(true,true); mSunsetManager.set_sun(); return(true); } , 4).then( mSunsetManager.low_skippable_text_bubble_event(GameStrings.GetString("MNPastro"), 4) , 4).then_one_shot( delegate(){ transition_to_TRANSITION_play(CharacterIndex.sOneHundred); } , 0); }
public void transition_to_CHOICE() { GS = NormalPlayGameState.PRECHOICE; mSunsetManager.add_character(NGM.CurrentCharacterLoader.Character, !CurrentPerformanceStat.BadPerformance); slide_image(mFlatCamera, null, mSunsetImage, false); CharacterIndex[] chars = available_choices(NGM.CurrentCharacterIndex.get_future_neighbor(0)); mChoiceHelper.shuffle_and_set_choice_poses(chars.Length, mChoosingManager); mChoosingManager.set_bb_choices(chars); if (!KeyMan.GetKey("HardSkip")) //if we are still holding the skip key at this point, go straight to choosing { //switch over to choice screen float gAgeDisplayDur = 7f; TED.add_event( delegate(float aTime){ //mSunsetManager.fade_characters(true,true); mSunsetManager.set_sun(); return(true); } , 5); TED.add_event( NGM.CurrentCharacterIndex == CharacterIndex.sFetus ? mSunsetManager.low_skippable_text_bubble_event(GameStrings.GetString("MNPtrans1"), gAgeDisplayDur) : mSunsetManager.low_skippable_text_bubble_event(GameStrings.GetString("MNPtrans2", NGM.CurrentCharacterIndex.get_future_neighbor(0).Age.ToString()), gAgeDisplayDur) , 2.5f).then_one_shot( delegate(){ slide_image(mFlatCamera, null, mChoosingImage); mManager.mMusicManager.fade_in_extra_music("choiceMusic"); GS = NormalPlayGameState.CHOICE; } , 0); } else { mSunsetManager.set_sun(); slide_image(mFlatCamera, null, mChoosingImage); mManager.mMusicManager.fade_in_extra_music("choiceMusic"); GS = NormalPlayGameState.CHOICE; } }
public void announce_unlock(CharacterIndex aChar, UnlockRequirements.UnlockData aData) { float gDisplayTime = 5; FlatUnlockBadge badge = new FlatUnlockBadge(aChar, aData, 30); badge.HardPosition = mSunset.mFlatCamera.get_point(Vector3.zero) + new Vector3(0, 2000, 0); badge.SoftPosition = mSunset.mFlatCamera.get_point(Vector3.zero); mElement.Add(badge); TED.add_one_shot_event( delegate() { badge.SoftPosition = badge.SoftPosition + new Vector3(0, -2000, 0); } , gDisplayTime).then_one_shot( delegate(){ mElement.Remove(badge); badge.destroy(); } , 1.5f); }
public override void OnActionExecuting(ActionExecutingContext context) { context.HttpContext.Session.Add("ID", 123123); int ID = (int)context.HttpContext.Session.Contents["ID"]; var rd = context.HttpContext.Request.RequestContext.RouteData; TED _db = new TED(); //if not in DB if (_db.Users.Find(ID) == null && rd.GetRequiredString("action") != "NoAccess") { RouteValueDictionary redirectTargetDictionary = new RouteValueDictionary(); redirectTargetDictionary.Add("action", "NoAccess"); redirectTargetDictionary.Add("controller", "Home"); redirectTargetDictionary.Add("area", ""); context.Result = new RedirectToRouteResult(redirectTargetDictionary); } base.OnActionExecuting(context); }
public void start_configuration_display() { EnableDepthWarning = false; int dState = 0; //0-started, 1-kinect not found TED.add_event( delegate(float aTime){ /* * if(!mManager.mZigManager.is_reader_connected()) * dState = 1; * else if(mManager.mZigManager.has_user() && false) //TODO test if user is in frame * dState = 4; * else if(mManager.mZigManager.has_user()) //TODO test if user is found * dState = 3; * else * dState = 2; */ if (can_start(aTime)) { go_to_play(); return(true); } if (dState == 1) { mMessageText.Text = GameStrings.GetString("TCMkinect2"); } else if (dState == 2) { mMessageText.Text = GameStrings.GetString("TCMkinect3"); } else { mMessageText.Text = ""; } return(false); } ); }
//this function is duplicated in NewInterfaceManager.cs and SunsetManager.cs. I would have used refs to TED and mElement but I can't use ref parameters inside of an anonymous function void clear_TED_and_fade_out_bubbles() { TED.clear_events(); foreach (var e in mElement) { var elt = e; if (elt.PrimaryGameObject.name == "genPOPUPTEXT") { TED.add_one_shot_event( delegate() { elt.SoftColor = new Color(0.5f, 0.5f, 0.5f, 0); } ).then_one_shot( delegate() { elt.destroy(); mElement.Remove(elt); } , 2); } } }
public void set_for_GRAVE(List <PerformanceStats> aStats) { //timing vars float gIntroText = 4.5f; float gPreScoreCount = 0.03f; float gScoreCount = 0.2f; float gPostScoreCount = 0.07f; float gRestart = 29; //disable the depth warning mManager.mZigManager.ForceShow = 2; //add the gravestone to the scene add_character(CharacterIndex.sGrave, true, false); //remove the grave if (aStats.Last().Character.Age == 999) { aStats.RemoveAt(aStats.Count - 1); } //add in fetus in case we skipped it in debug mode if (aStats.First().Character.Age != 0) { aStats.Insert(0, new PerformanceStats(new CharacterIndex(0, 0))); } //fake it for testing... /* TODO DELETE move this into ModeNormalPlay on force kill * mCharacters.Last().destroy(); //remove the grave * mElement.Remove(mCharacters.Last()); * mCharacters.RemoveAt(mCharacters.Count -1); * Random.seed = 123; * for(int i = 0; i < 8; i++) * { * if(aStats.Last().Character.Age < (new CharacterIndex(i,0)).Age) * { * PerformanceStats stat = new PerformanceStats(new CharacterIndex(i,Random.Range(0,4))); * stat.update_score(0,Random.value); * stat.update_score(1,Random.value); * stat.Stats = mManager.mGameManager.CharacterHelper.Characters[stat.Character]; * aStats.Add(stat); * * add_character(stat.Character,false); * } * } * add_character(CharacterIndex.sGrave,false); //add the grave back in */ //this is all a hack to get the score to show up right... float scoreIncrementor = 0; FlatElementText finalScoreText = new FlatElementText(mManager.mNewRef.serifFont, 70, "0", 21); finalScoreText.HardColor = (GameConstants.UiGraveText); FlatElementText finalAgeText = new FlatElementText(mManager.mNewRef.serifFont, 50, "0", 21); float ageIncrementer = 0; finalAgeText.HardColor = (GameConstants.UiGraveText); //perfectPercent.Text = ((int)(100*aStats.Sum(e=>e.Stats.Perfect+1)/(float)(aStats.Count*3))).ToString() + "%"; //TODO why this no work?? finalAgeText.Text = "0"; //aStats.Last().Character.Age.ToString(); //hack to put things into bg camera foreach (Renderer f in finalScoreText.PrimaryGameObject.GetComponentsInChildren <Renderer>()) { f.gameObject.layer = 4; } foreach (Renderer f in finalAgeText.PrimaryGameObject.GetComponentsInChildren <Renderer>()) { f.gameObject.layer = 4; } //foreach (Renderer f in perfectEngraving.PrimaryGameObject.GetComponentsInChildren<Renderer>()) f.gameObject.layer = 4; Vector3 graveCenter = mCharacters[mCharacters.Count - 1].HardPosition + new Vector3(0, 50, 0); finalScoreText.HardPosition = graveCenter + new Vector3(30, -180, 0); finalAgeText.HardPosition = graveCenter + new Vector3(25, 0, 0); mElement.Add(finalScoreText); //mElement.Add(perfectEngraving); mElement.Add(finalAgeText); graveCleanup.Add(finalScoreText); graveCleanup.Add(finalAgeText); TimedEventDistributor.TimedEventChain chain = TED.empty_chain(); chain = chain.then_one_shot( delegate { set_sun(); } , 0); chain = chain.then( low_skippable_text_bubble_event(GameStrings.GetString("SM1"), gIntroText), 3); /*.then( //wait a little bit to let the fading finish * low_skippable_text_bubble_event("HERE IS YOUR LIFE STORY",gIntroText) * );*/ for (int i = 1; i < aStats.Count; i++) { PerformanceStats ps = aStats[i]; chain = chain.then_one_shot( delegate() { if (ps.Character != CharacterIndex.sOneHundred) { show_score(ps.Character, (int)ps.AdjustedScore, gPreScoreCount + gScoreCount + gPostScoreCount + 1.5f); } } , gPreScoreCount).then( delegate(float aTime) { if (aTime < gScoreCount) { float displayScore = scoreIncrementor + (aTime / gScoreCount) * ps.AdjustedScore; float displayAge = ageIncrementer + (aTime / gScoreCount) * (ps.Character.Age - ageIncrementer); finalScoreText.Text = "" + (int)displayScore; finalAgeText.Text = "" + (int)displayAge; } if (aTime > gScoreCount + gPostScoreCount) { scoreIncrementor += ps.AdjustedScore; ageIncrementer = ps.Character.Age; finalScoreText.Text = "" + (int)scoreIncrementor; finalAgeText.Text = "" + (int)ageIncrementer; return(true); } return(false); }, 0); } chain = chain.wait(2.5f); //CONNECTIONS for (int i = 1; i < aStats.Count; i++) { PerformanceStats ps = aStats[i]; float gFirstConnectionText = 5f; float gConnectionText = 5f; float gPreParticle = 2f; //TODO grave connections CharIndexContainerString connections; //TODO bool wasHard = ps.Stats.Difficulty > 1; if (wasHard) { connections = mManager.mCharacterBundleManager.get_character_stat(ps.Character).CharacterInfo.HardConnections; } else { connections = mManager.mCharacterBundleManager.get_character_stat(ps.Character).CharacterInfo.EasyConnections; } //for each connection, check if it is relevent to the currently looping character for (int j = 1; j < aStats.Count; j++) { var targetCharacter = aStats[j].Character; //charcter we are connecting to var targetConnection = connections[targetCharacter]; //message if (targetConnection != null && targetConnection != "") { int accumChange = 0; //accum change is targetCharacters effect on the current character accumChange = aStats[j].CutsceneChangeSet.accumulative_changes()[ps.Character]; if ((wasHard && accumChange > 0) || //if was hard and effect was positive (i.e. hard) (!wasHard && accumChange < 0)) //if was easy and effect was negative (i.e. easy) { string [] conText = targetConnection.Replace("<S>", "@").Split('@'); PopupTextObject npo = null; chain = chain.then( delegate(float aTime) { if (npo == null) { npo = add_timed_text_bubble(conText[0], gFirstConnectionText + gConnectionText, -0.6f, 1); set_popup_color_for_cutscene_particles(npo, wasHard); create_shine_over_character(targetCharacter, !wasHard, gFirstConnectionText + gConnectionText); TED.add_one_shot_event( delegate() { create_shine_over_character(ps.Character, !wasHard, gFirstConnectionText + gConnectionText - 0.3f); } , 0.3f); } if (npo.IsDestroyed || aTime > gPreParticle) { return(true); } return(false); } , 0); System.Func <FlatElementBase, float, bool> jiggleDelegate = delegate(FlatElementBase aBase, float aTime2) { aBase.mLocalRotation = Quaternion.AngleAxis(Mathf.Sin(aTime2 * Mathf.PI * 2 * 8) * 10f, Vector3.forward); if (aTime2 >= (gFirstConnectionText - gPreParticle) / 4f) { aBase.mLocalRotation = Quaternion.identity; return(true); } return(false); }; chain = chain.then_one_shot( delegate() { if (npo != null) { mCharacters[char_to_list_index(targetCharacter)].Events.add_event(jiggleDelegate, 0); ManagerManager.Manager.mMusicManager.play_sound_effect("graveShine"); } //create the shine } ).then_one_shot( delegate() { if (npo != null && !npo.IsDestroyed) //if we used softskip, npo could be destroyed at this point { npo.Text = conText.Last(); mCharacters[char_to_list_index(ps.Character)].Events.add_event(jiggleDelegate, 0); ManagerManager.Manager.mMusicManager.play_sound_effect("graveShine"); } }, gFirstConnectionText - gPreParticle).then( delegate(float aTime){ if (npo.IsDestroyed || aTime > gConnectionText) { npo = null; return(true); } return(false); } ); } } } } string deathSentence = ""; if (aStats[aStats.Count - 1].DeathTime != -1) { deathSentence += GameStrings.GetString("SM2"); } else { deathSentence += GameStrings.GetString("SM3"); } if (!aStats [aStats.Count - 1].Character.IsDescriptionAdjective) { if ("aeiouAEIOU".IndexOf(aStats[aStats.Count - 1].Character.Description[0]) >= 0) { deathSentence += GameStrings.GetString("SM4"); } else { deathSentence += GameStrings.GetString("SM5"); } } deathSentence += aStats[aStats.Count - 1].Character.Description; chain = chain.then( low_skippable_text_bubble_event(deathSentence, gIntroText) , 1); foreach (CharacterIndex e in CharacterIndex.sAllCharacters) { UnlockRequirements.UnlockData unlockData; if (mManager.mMetaManager.UnlockManager.unlockedThisGame.TryGetValue(new UnlockRequirements.FakeCharIndex(e), out unlockData)) { if (unlockData != null) { ManagerManager.Log("announcing unlock " + e.StringIdentifier); CharacterIndex ce = new CharacterIndex(e); chain = chain.then_one_shot( delegate(){ mUnlockAnnouncer.announce_unlock(ce, unlockData); } , 0).then( delegate(float aTime){ return(!mUnlockAnnouncer.IsAnnouncing); } , 0); } } } //so we don't announce unlock again when we restart mManager.mMetaManager.UnlockManager.unlockedThisGame.Clear(); if (GameConstants.showReward && aStats[aStats.Count - 1].Character.LevelIndex >= 7) { FlatElementImage rewardImage = null; FlatElementImage rewardFrame = null; mModeNormalPlay.mGiftManager.set_background_for_render(); chain = chain.then_one_shot( delegate() { var frameImg = mManager.mCharacterBundleManager.get_image("GIFT_frame"); rewardFrame = new FlatElementImage(frameImg.Image, frameImg.Data.Size, 24); rewardImage = new FlatElementImage(mModeNormalPlay.mGiftManager.render_gift(0), new Vector2(2001, 1128), 23); //TODO play sound effect rewardImage.HardPosition = mFlatCamera.get_point(0, 3); rewardFrame.HardPosition = rewardImage.HardPosition; rewardImage.SoftPosition = mFlatCamera.get_point(Vector3.zero) + new Vector3(0, 150, 0); rewardFrame.SoftPosition = rewardImage.SoftPosition + new Vector3(0, 70, 0); mElement.Add(rewardImage); mElement.Add(rewardFrame); graveCleanup.Add(rewardImage); graveCleanup.Add(rewardFrame); var subChain = TED.empty_chain().wait(4); if (mModeNormalPlay.mGiftManager.gift_count() > 0) { for (int i = 1; i < 100; i++) { int localIndex = i % mModeNormalPlay.mGiftManager.gift_count(); subChain = subChain.then_one_shot( delegate(){ //TODO sound effect mModeNormalPlay.mGiftManager.render_gift(localIndex); } , 1f); } } } , 2); //chain = chain.wait(6); //chain = chain.then(skippable_text_bubble_event("YOU ARE THE PERFECT WOMAN!",5,-0.8f,2),0); } //variables for credits animation.. float lastTime = 0; FlatElementImage[] logos = null; //PopupTextObject gameOver = null; List <FlatElementText> creditsText = new List <FlatElementText>(); float scrollSpeed = 820; mGraveCompleteCb = delegate() { Vector3 barYPosition = mFlatCamera.get_point(Vector3.zero) + new Vector3(0, -700, 0); TED.add_one_shot_event( delegate() { mManager.mMusicManager.fade_in_extra_music("creditsMusic"); mManager.mMusicManager.fade_out(); var imgData = mManager.mCharacterBundleManager.get_image("BAR"); var barImg = new FlatElementImage(imgData.Image, imgData.Data.Size, 24); barImg.HardPosition = barYPosition + new Vector3(0, -1000, 0); barImg.SoftPosition = barYPosition; mElement.Add(barImg); graveCleanup.Add(barImg); } , 0).then_one_shot( delegate() { float lastXPosition = mFlatCamera.get_point(Vector3.zero).x - mFlatCamera.Width / 2 - 100; int counter = 0; foreach (string e in GameConstants.credits) { string val = e; if (System.Text.RegularExpressions.Regex.IsMatch(e, @"^\d+$")) { val = GameStrings.GetString("GCcredits" + e); } var text = new FlatElementText(mManager.mNewRef.genericFont, 70, val, 25); float textWidth = text.BoundingBox.width; text.HardColor = new Color(1, 1, 1, 1); text.HardPosition = new Vector3(lastXPosition - textWidth / 2f, barYPosition.y, 0); lastXPosition += -textWidth - 75; creditsText.Add(text); mElement.Add(text); graveCleanup.Add(text); counter++; } if (GameConstants.SHOW_LOGOS) { logos = new FlatElementImage[3]; lastXPosition += -200; string[] imageNames = new string[] { "LOGO_FA", "LOGO_AI", "LOGO_GL" }; for (int i = 0; i < imageNames.Length; i++) { var imgData = mManager.mCharacterBundleManager.get_image(imageNames[i]); var img = new FlatElementImage(imgData.Image, imgData.Data.Size, 25); float imgWidth = img.BoundingBox.width; img.HardPosition = new Vector3(lastXPosition - imgWidth / 2, barYPosition.y, 0); lastXPosition += -img.BoundingBox.width / 2f - 500; logos[i] = img; mElement.Add(img); graveCleanup.Add(img); } } } , 1).then_one_shot( delegate() { /* this will fade everything out super slowly * List<FlatElementBase> graveItems = new List<FlatElementBase>(){finalScoreText,perfectPercent}; * foreach(FlatElementBase e in * mCharacters.Cast<FlatElementBase>() * .Concat(mDiffLabels.Cast<FlatElementBase>()) * .Concat(mScoreLabels.Cast<FlatElementBase>()) * .Concat(mScoreTexts.Cast<FlatElementBase>()) * .Concat(graveItems.Cast<FlatElementBase>())) * { * e.ColorInterpolationLimit = 0.05f; * e.SoftColor = GameConstants.UiWhiteTransparent; * }*/ } , 0).then( delegate(float aTime) { //scroll contents down Vector3 scroll = new Vector3(scrollSpeed * (aTime - lastTime), 0, 0); foreach (FlatElementText e in creditsText) { e.SoftPosition = e.SoftPosition + scroll; } if (logos != null) { foreach (FlatElementImage e in logos) { e.SoftPosition = e.SoftPosition + scroll; } } lastTime = aTime; if (Input.GetKeyDown(KeyCode.Alpha0)) { return(true); } if (aTime > gRestart) { return(true); } return(false); } , 0).then_one_shot( delegate(){ mManager.mMusicManager.fade_out_extra_music(); mManager.restart_game(); } , 0); mGraveCompleteChain = TED.LastEventKeyAdded; }; chain = chain.then_one_shot( delegate() { mGraveCompleteCb(); mGraveCompleteCb = null; mGraveChain = null; } , 1); mGraveChain = TED.LastEventKeyAdded; }
//bubble types 0 - regular, 1 - long small, 2 - long big public PopupTextObject add_timed_text_bubble(string aMsg, float duration, float yRelOffset = 0, int bubbleType = 0) { PopupTextObject to = null; if (bubbleType == 0) { to = new PopupTextObject(aMsg, 30); } else if (bubbleType == 1) { string[] bubbleNames = new string[] { "SUNSET_BUBBLE-0", "SUNSET_BUBBLE-1", "SUNSET_BUBBLE-2" }; //TODO put in actual random bubbless var bubbleImg = mManager.mCharacterBundleManager.get_image(bubbleNames[mLastSunsetBubbleIndex]); mLastSunsetBubbleIndex = (mLastSunsetBubbleIndex + 1) % 3; to = new PopupTextObject(aMsg, 30, bubbleImg.Image, bubbleImg.Data.Size); } else if (bubbleType == 2) { var bubbleImg = mManager.mCharacterBundleManager.get_image("SELECTION_BUBBLE"); to = new PopupTextObject(aMsg, 30, bubbleImg.Image, bubbleImg.Data.Size); //hack fix, don't do this to.HardText = aMsg; } to.HardPosition = mFlatCamera.get_random_point_off_camera(-2300); to.HardColor = GameConstants.UiWhiteTransparent; to.SoftColor = GameConstants.UiWhite; //to.set_text_color(GameConstants.UiWhiteTransparent,true); to.set_text_color(GameConstants.UiRed, true); //to.set_background_color(GameConstants.UiWhiteTransparent,true); to.set_background_color(GameConstants.UiPopupBubble, true); TED.add_event( delegate(float aTime) { to.SoftPosition = mFlatCamera.get_point(0, yRelOffset); //fly in //to.HardPosition = mFlatCamera.get_point(0.40f,yRelOffset); //cut in mElement.Add(to); return(true); }, 0.1f).then( //bleah hacky delay delegate(float aTime) { if (aTime > duration) { return(true); } if (mModeNormalPlay.DoSkipSingleThisFrame) { mModeNormalPlay.DoSkipSingleThisFrame = false; return(true); } return(false); }, 0).then_one_shot( delegate() { //cutout //mElement.Remove(to); //to.destroy(); //fadeout to.fade_out(); }, 0).then_one_shot( delegate() { //fadeout mElement.Remove(to); to.destroy(); }, 2); return(to); }
//this needs to be called in order of characters created.... public void show_score(CharacterIndex aIndex, int aScore, float showTime, float jiggleDelayTime = 0) { int ind = char_to_list_index(aIndex); FlatElementText scoreText = new FlatElementText(mManager.mNewRef.fatFont, 40, aScore.ToString(), 21); var scoreBgImage = mManager.mCharacterBundleManager.get_image("SCORELABEL"); FlatElementImage scoreBg = new FlatElementImage(scoreBgImage.Image, scoreBgImage.Data.Size, 20); scoreBg.HardPosition = mFlatCamera.get_point(0, 1.5f); //SLOPPY, restart will clear out all characters but the TED will still be running and calling this function which will crash here if (mCharacters.Count > ind) { scoreBg.HardPosition = mCharacters[ind].SoftPosition + new Vector3(0, 400, 0); } scoreText.HardPosition = scoreBg.HardPosition; scoreText.SoftPosition = scoreBg.SoftPosition; scoreText.Text = "" + aScore; scoreText.PositionInterpolationMinLimit = 200f; scoreBg.PositionInterpolationMinLimit = 200f; scoreText.ColorInterpolationMinLimit = 2f; scoreBg.ColorInterpolationMinLimit = 2f; mScoreLabels.Add(scoreBg); mScoreTexts.Add(scoreText); mElement.Add(scoreBg); mElement.Add(scoreText); System.Func <FlatElementBase, float, bool> scoreJiggleDelegate = delegate(FlatElementBase aBase, float aTime2) { aTime2 -= jiggleDelayTime; if (aTime2 > 0) { aBase.mLocalRotation = Quaternion.AngleAxis(Mathf.Sin(aTime2 * Mathf.PI * 2 * 4) * 15f, Vector3.forward); if (aTime2 >= 0.7f) { aBase.mLocalRotation = Quaternion.identity; return(true); } } return(false); }; scoreBg.Events.add_event(scoreJiggleDelegate, 0.03f); scoreText.Events.add_event(scoreJiggleDelegate, 0.03f); //play the counting sound TED.add_one_shot_event(delegate(){ mManager.mMusicManager.play_sound_effect("counting"); }, jiggleDelayTime); TED.add_event( delegate(float aTime) { if (aTime > showTime) { scoreBg.SoftColor = GameConstants.UiWhiteTransparent; scoreText.SoftColor = GameConstants.UiWhiteTransparent; return(true); } return(false); } , 0).then_one_shot( delegate(){ mScoreLabels.Remove(scoreBg); mScoreTexts.Remove(scoreText); mElement.Remove(scoreBg); mElement.Remove(scoreText); scoreBg.destroy(); scoreText.destroy(); } , 3); }
public void transition_to_DEATH() { float gTextDisplayDur = 5; bool firstDeath = mPerformanceStats.Where(e => e.DeathTime != -1).Count() < GameConstants.numberRetries; if (NGM.CurrentCharacterIndex.LevelIndex == 7) //no retry at age 85 { firstDeath = false; } CurrentPerformanceStat.DeathTime = PercentTimeCompletion; var chain = TED.add_one_shot_event(delegate(){}); if (firstDeath) { GS = NormalPlayGameState.CUTSCENE; mManager.mMusicManager.play_sound_effect("cutBad"); load_CUTSCENE(CurrentPerformanceStat.CutsceneChangeSet); } else { GS = NormalPlayGameState.DEATH; chain = chain.then_one_shot( delegate() { mManager.mBodyManager.transition_character_out(); mManager.mTransparentBodyManager.transition_character_out(); mManager.mMusicManager.play_sound_effect("cutDie"); mManager.mMusicManager.play_cutscene_music(NGM.CurrentCharacterLoader.Images.deathMusic); if (NGM.CurrentCharacterLoader.has_cutscene(4)) { mManager.mBackgroundManager.load_cutscene(4, NGM.CurrentCharacterLoader); } //CAN DELETE //else if (NGM.DeathCharacter != null){mManager.mBackgroundManager.load_cutscene(4, NGM.DeathCharacter);} } ); } //BAD PERFORMANCE chain = chain.then( mInterfaceManager.skippable_text_bubble_event(firstDeath ? GameStrings.GetString("MNPdeath1") : GameStrings.GetString("MNPdeath2"), gTextDisplayDur) , 2); if (!firstDeath && NGM.CurrentLevel == 7) { chain = chain.then( mInterfaceManager.skippable_text_bubble_event(GameStrings.GetString("MNPdeath3"), gTextDisplayDur) , 0).then( mInterfaceManager.skippable_text_bubble_event(GameStrings.GetString("MNPdeath4"), gTextDisplayDur) , 0); } //NEXT TIME YOU PERFORM THAT BAD YOU MIGHT DIE if (firstDeath) //if we haven't died previously { chain = chain.then(mInterfaceManager.skippable_text_bubble_event(GameStrings.GetString("MNPdeath5"), gTextDisplayDur), 0); chain = chain.then_one_shot( delegate(){ mInterfaceManager.set_for_CUTSCENE( delegate(){ CUTSCENE_finished(CurrentPerformanceStat.CutsceneChangeSet); }, CurrentPerformanceStat.CutsceneChangeSet, false ); } , 0); return; } chain = chain.then_one_shot( delegate(){ mInterfaceManager.set_for_DEATH(CurrentPerformanceStat.Character) .then_one_shot( delegate() { transition_to_TRANSITION_play(new CharacterIndex("999")); } , 0); } ); }
public void update() { //cheater keys for skipping if (KeyMan.GetKeyDown("HardSkip")) { DoSkipMultipleThisFrame = true; } if (KeyMan.GetKeyDown("SoftSkip")) { DoSkipSingleThisFrame = true; } //TODO not sure why I put this here but this most most def. does not work //if(Input.GetKeyDown(KeyCode.Alpha8)) //transition_to_TRANSITION_play(new CharacterIndex("999")); //mManager.mTransparentBodyManager.transition_character_in(GameConstants.UiWhiteTransparent); //handle cheater keys for choosing if (GS == NormalPlayGameState.CHOICE) { //cheater keys for difficulty if ( NGM.CurrentCharacterIndex.LevelIndex < 7 && (Input.GetKeyDown(KeyCode.Q) || Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.R))) { if (Input.GetKeyDown(KeyCode.Q)) { NGM.CharacterHelper.Characters[NGM.CurrentCharacterIndex.get_future_neighbor(0)].Difficulty += 1; } if (Input.GetKeyDown(KeyCode.W)) { NGM.CharacterHelper.Characters[NGM.CurrentCharacterIndex.get_future_neighbor(1)].Difficulty += 1; } if (Input.GetKeyDown(KeyCode.E)) { NGM.CharacterHelper.Characters[NGM.CurrentCharacterIndex.get_future_neighbor(2)].Difficulty += 1; } if (Input.GetKeyDown(KeyCode.R)) { NGM.CharacterHelper.Characters[NGM.CurrentCharacterIndex.get_future_neighbor(3)].Difficulty += 1; } for (int i = 0; i < 4; i++) { NGM.CharacterHelper.Characters[NGM.CurrentCharacterIndex.get_future_neighbor(i)].Difficulty %= 4; } mChoosingManager.set_bb_choices(NGM.CurrentCharacterIndex.get_future_neighbor(0).get_neighbors()); } //KeyCode[] levelKeys = new KeyCode[]{KeyCode.Q,KeyCode.W,KeyCode.E,KeyCode.R,KeyCode.T,KeyCode.Z,KeyCode.U,KeyCode.I}; //KeyCode[] choiceKeys = new KeyCode[]{KeyCode.Alpha1,KeyCode.Alpha2,KeyCode.Alpha3,KeyCode.Alpha4}; string[] levelKeys = new string[] { "lvl1", "lvl2", "lvl3", "lvl4", "lvl5", "lvl6", "lvl7", "lvl8" }; string[] choiceKeys = new string[] { "Choice1", "Choice2", "Choice3", "Choice4" }; for (int i = 0; i < levelKeys.Length; i++) { if (KeyMan.GetKey(levelKeys[i])) { for (int j = 0; j < choiceKeys.Length; j++) { if (KeyMan.GetKeyDown(choiceKeys[j])) { slide_image(mFlatCamera, mChoosingImage, null); slide_image(mFlatCamera, mSunsetImage, null, false); mManager.mMusicManager.fade_out_extra_music(); mManager.mMusicManager.fade_out(0); mManager.mAssetLoader.new_load_character((new CharacterIndex(i + 1, j)).StringIdentifier, mManager.mCharacterBundleManager); } } } } } mInterfaceManager.Update(); mSunsetManager.update(); mChoosingManager.update(); mGiftManager.update(); //TODO only draw if necessary draw_render_texture(mSunsetManager.mFlatCamera); draw_render_texture(mChoosingManager.mFlatCamera); //draw_render_texture(mInterfaceManager.mFlatCamera); mFlatCamera.update(Time.deltaTime); foreach (FlatElementBase e in mElement) { e.update(Time.deltaTime); } if (GS == NormalPlayGameState.PLAY) { //if(Input.GetKeyDown(KeyCode.P)) // mParticles.create_particles(mGrading); update_PLAY(); if (KeyMan.GetKeyDown("HardSkip")) { TimeRemaining = -5; //0; } } else if (GS == NormalPlayGameState.CHOICE) { update_CHOICE(); } mParticles.update(Time.deltaTime); TED.update(Time.deltaTime); //hacks if (DoSkipMultipleThisFrame) { mInterfaceManager.skip_cutscene(); mSunsetManager.skip_grave(); //grave skipping lul DoSkipMultipleThisFrame = false; } if (DoSkipSingleThisFrame) { DoSkipSingleThisFrame = false; } }
public void character_loaded() { //this means we are start/restarting the game if (NGM.CurrentCharacterLoader.Character == CharacterIndex.sFetus) { reset_stats_and_difficulties(); } //reveal the character with sound mManager.mMusicManager.play_sound_effect("transitionOut"); slide_image(mFlatCamera, mSunsetImage, null, false); //we use the hack version instead that allows us to skip characters set_last_performance_stat_to_character(NGM.CurrentCharacterIndex); //mPerformanceStats.Add(new PerformanceStats(NGM.CurrentCharacterIndex)); //CurrentPerformanceStat.Stats = NGM.CharacterHelper.Characters[NGM.CurrentCharacterIndex]; mInterfaceManager.begin_new_character(CurrentPerformanceStat); //set particle color mParticles.mParticles.set_emitter_particle_color(mManager.mCharacterBundleManager.get_character_stat(NGM.CurrentCharacterIndex).CharacterInfo.CharacterOutlineColor / 2f, 2); if (NGM.CurrentCharacterLoader.Character != CharacterIndex.sFetus) { mGiftManager.add_character(NGM.CurrentCharacterLoader.Character); } switch (NGM.CurrentCharacterLoader.Name) { case "0-1": set_time_for_PLAY(999999f); setup_next_poses(true); transition_to_PLAY(); float gTextDisplayDur = 4; NGM.CurrentTargetPose = null; System.Action transPose = delegate() { NGM.CurrentTargetPose = mManager.mReferences.mCheapPose.to_pose(); mManager.mTransparentBodyManager.set_target_pose(NGM.CurrentTargetPose); mManager.mTransparentBodyManager.transition_character_in(mManager.mCharacterBundleManager.get_character_stat(NGM.CurrentCharacterIndex).CharacterInfo.CharacterOutlineColor); }; if (mManager.mMetaManager.UnlockManager.mUnlocked.numberGamesPlayed == 0 || GameConstants.TUTORIAL_ONCE != true) { TED.add_event( mInterfaceManager.skippable_text_bubble_event(GameStrings.GetString("MNPfetus1"), gTextDisplayDur), 3).then_one_shot( transPose, 0).then( mInterfaceManager.skippable_text_bubble_event(GameStrings.GetString("MNPfetus2"), gTextDisplayDur), 1.5f); } else { TED.add_one_shot_event(transPose, 2); } break; case "110": set_time_for_PLAY(GameConstants.playAstronautPlayTime); //astronaut scene is shorter setup_next_poses(true); //astronaut scene has no transparent pose mAstronaut.start_astro(); mManager.mBackgroundManager.hide_bg_and_fg_elements(true); mInterfaceManager.hide_interface(); transition_to_PLAY(); TED.add_event( mInterfaceManager.skippable_text_bubble_event(GameStrings.GetString("MNPfetus3"), 4), 1); CurrentPerformanceStat.update_score(0, 1); //give astronaut perfect score CurrentPerformanceStat.update_score(1, 1); break; default: set_time_for_PLAY(GameConstants.playDefaultPlayTime); setup_next_poses(false); transition_to_PLAY(); break; } }
//this function updates music and background and removes characters //pass in CurrentPerformanceStat.CutsceneChangeSet; public void load_CUTSCENE(NUPD.ChangeSet changes) { int changeIndex = -1; if (changes == null) { Debug.Log("could not find change in threshold with performance: " + CurrentPerformanceStat); changes = new NUPD.ChangeSet(); changes.Changes.Add(new NUPD.ChangeSubSet() { Description = "No changes available!!" }); } else { changeIndex = changes.Index; } //audio //TODO change index is no longe relevant if (changeIndex != -1) { //if(CurrentCharacterLoader.Images.cutsceneMusic.Count > changeIndex) if (NGM.CurrentCharacterLoader.Images.cutsceneMusic.Count > 1) { if (NGM.CurrentCharacterIndex != CharacterIndex.sOneHundred) { mManager.mMusicManager.play_sound_effect(CurrentPerformanceStat.BadPerformance ? "cutBad" : "cutGood"); } AudioClip cutsceneClip = NGM.CurrentCharacterLoader.Images.cutsceneMusic[CurrentPerformanceStat.BadPerformance ? 0 : 1]; mManager.mMusicManager.play_cutscene_music(cutsceneClip); //mManager.mMusicManager.fade_in_cutscene_music(CurrentCharacterLoader.Images.cutsceneMusic[changes.UpperThreshold <= 0.5 ? 0 : 1]); TED.add_event( delegate(float aTime){ if (mManager.mMusicManager.MusicClip == cutsceneClip) { //if we're still in the cutscene and the cutscene music has stopped playing if (!mManager.mMusicManager.IsMusicSourcePlaying && GS == NormalPlayGameState.CUTSCENE) { mManager.mMusicManager.play_music(NGM.CurrentCharacterLoader.Images.backgroundMusic, 0, true); mManager.mMusicManager.fade_in(5, 0.2f); return(true); } } else { return(true); } return(false); } , 0); } else { //Debug.Log("ERROR no music found for change index " + changeIndex + " only " + CurrentCharacterLoader.Images.cutsceneMusic.Count + " sounds"); Debug.Log("No cutscene music for " + NGM.CurrentCharacterIndex.StringIdentifier); } } //visuals mManager.mBodyManager.transition_character_out(); mManager.mTransparentBodyManager.transition_character_out(); if (space_camp_final_exam()) { mManager.mBackgroundManager.hide_bg_and_fg_elements(); } else if (CurrentPerformanceStat.BadPerformance && NGM.CurrentCharacterLoader.has_cutscene(1) && NGM.CurrentCharacterIndex != CharacterIndex.sOneHundred) //if bad performance, has cutscene and is NOT astronaut { mManager.mBackgroundManager.load_cutscene(1, NGM.CurrentCharacterLoader); } else { mManager.mBackgroundManager.load_cutscene(0, NGM.CurrentCharacterLoader); } }