コード例 #1
0
    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);
    }
コード例 #2
0
    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);
        }
    }
コード例 #3
0
 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);
 }
コード例 #4
0
    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);
    }
コード例 #5
0
    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);
    }
コード例 #6
0
 //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);
         }
     }
 }
コード例 #7
0
    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;
    }
コード例 #8
0
    //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);
    }
コード例 #9
0
    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);
        }
            );
    }
コード例 #10
0
    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;
        }
    }