//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 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); } ); }
//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 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); } }