public void PlayAnim(PLCA anim)
 {
     if (!(animCtrl == null))
     {
         animCtrl.Play(anim, false);
     }
 }
예제 #2
0
 public void RequestPose(string pose_name)
 {
     if (!(playerAnimCtrl == null))
     {
         try
         {
             PLCA anim = (PLCA)(int)Enum.Parse(typeof(PLCA), pose_name);
             playerAnimCtrl.Play(anim, false);
         }
         catch
         {
             Log.Error(LOG.GAMESCENE, "不正なモ\u30fcションコマンド:" + pose_name);
         }
     }
 }
    public static PlayerAnimCtrl Get(Animator _animator, PLCA default_anim, Action <PlayerAnimCtrl, PLCA> on_play = null, Action <PlayerAnimCtrl, PLCA> on_change = null, Action <PlayerAnimCtrl, PLCA> on_end = null)
    {
        //IL_0027: Unknown result type (might be due to invalid IL or missing references)
        if (_animator == null)
        {
            return(null);
        }
        InitTable();
        PlayerAnimCtrl playerAnimCtrl = _animator.GetComponent <PlayerAnimCtrl>();

        if (playerAnimCtrl == null)
        {
            playerAnimCtrl = _animator.get_gameObject().AddComponent <PlayerAnimCtrl>();
        }
        playerAnimCtrl.animator           = _animator;
        playerAnimCtrl.onPlay             = on_play;
        playerAnimCtrl.onChange           = on_change;
        playerAnimCtrl.onEnd              = on_end;
        playerAnimCtrl.transitionDuration = 0.1f;
        playerAnimCtrl.defaultAnim        = default_anim;
        playerAnimCtrl.Play(default_anim, true);
        return(playerAnimCtrl);
    }
예제 #4
0
    private IEnumerator DoFreeMove()
    {
        while (true)
        {
            if (waitTime > 0f)
            {
                WaitInFreeMove();
                yield return((object)null);
            }
            else if (discussionTimer != 0f)
            {
                if (discussionTimer < 0f)
                {
                    if (this is HomeNPCCharacter && homePeople.selfChara != null)
                    {
                        HomeNPCCharacter npc = (HomeNPCCharacter)this;
                        if (npc != null && npc.nearAnim != PLCA.IDLE_01)
                        {
                            Vector2 val = homePeople.selfChara._transform.get_position().ToVector2XZ() - _transform.get_position().ToVector2XZ();
                            if (val.get_sqrMagnitude() < 9f)
                            {
                                PlayNearAnim(npc);
                            }
                            else if (animCtrl.playingAnim != animCtrl.defaultAnim)
                            {
                                animCtrl.PlayDefault(false);
                            }
                            yield return((object)null);

                            continue;
                        }
                    }
                    if (this is HomePlayerCharacter)
                    {
                        if (Random.Range(0, 10) == 0)
                        {
                            animCtrl.Play(PlayerAnimCtrl.emotionAnims, false);
                            discussionTimer = Random.Range(2f, 4f);
                        }
                        else if (Random.Range(0, 2) == 0)
                        {
                            animCtrl.Play(PlayerAnimCtrl.talkAnims, false);
                            discussionTimer = Random.Range(5f, 10f);
                        }
                        else
                        {
                            animCtrl.PlayIdleAnims(sexType, false);
                            discussionTimer = Random.Range(3f, 6f);
                        }
                    }
                }
                else
                {
                    discussionTimer -= Time.get_deltaTime();
                }
                yield return((object)null);
            }
            else
            {
                SetupNextWayPoint();
                yield return((object)null);

                if (MonoBehaviourSingleton <HomeManager> .IsValid())
                {
                    moveTargetPos = MonoBehaviourSingleton <HomeManager> .I.HomePeople.GetTargetPos(this, wayPoint);
                }
                else if (MonoBehaviourSingleton <LoungeManager> .IsValid())
                {
                    moveTargetPos = MonoBehaviourSingleton <LoungeManager> .I.HomePeople.GetTargetPos(this, wayPoint);
                }
                while (true)
                {
                    animCtrl.PlayMove(false);
                    Vector3    pos          = _transform.get_position();
                    Vector3    diff         = moveTargetPos - pos;
                    Vector2    val2         = diff.ToVector2XZ();
                    Vector2    dir3         = val2.get_normalized();
                    Quaternion val3         = Quaternion.LookRotation(dir3.ToVector3XZ());
                    Vector3    eulerAngles  = val3.get_eulerAngles();
                    float      rot2         = eulerAngles.y;
                    float      vel2         = 0f;
                    Vector3    eulerAngles2 = _transform.get_eulerAngles();
                    rot2 = Mathf.SmoothDampAngle(eulerAngles2.y, rot2, ref vel2, 0.1f);
                    _transform.set_eulerAngles(new Vector3(0f, rot2, 0f));
                    if (diff.get_magnitude() < 0.75f)
                    {
                        break;
                    }
                    yield return((object)null);
                }
                if (wayPoint.get_name().StartsWith("LEAF"))
                {
                    break;
                }
                if (wayPoint.get_name().StartsWith("WAIT"))
                {
                    while (true)
                    {
                        Vector3 eulerAngles3 = wayPoint.get_transform().get_eulerAngles();
                        float   dir2         = eulerAngles3.y;
                        float   vel          = 0f;
                        Vector3 eulerAngles4 = _transform.get_eulerAngles();
                        dir2 = Mathf.SmoothDampAngle(eulerAngles4.y, dir2, ref vel, 0.1f);
                        _transform.set_eulerAngles(new Vector3(0f, dir2, 0f));
                        vel = Mathf.Abs(vel);
                        if (vel > 15f)
                        {
                            animCtrl.Play(PLCA.WALK, false);
                        }
                        else if (!string.IsNullOrEmpty(wayPoint.waitAnimStateName))
                        {
                            PLCA motion = PlayerAnimCtrl.StringToEnum(wayPoint.waitAnimStateName);
                            animCtrl.Play(motion, false);
                        }
                        else if (this is LoungeMoveNPC)
                        {
                            animCtrl.PlayDefault(false);
                        }
                        else
                        {
                            animCtrl.PlayIdleAnims(sexType, false);
                        }
                        animator.set_applyRootMotion(false);
                        if (vel < 0.01f)
                        {
                            break;
                        }
                        yield return((object)null);
                    }
                    animCtrl.PlayIdleAnims(sexType, false);
                    waitTime = Random.Range(3f, 8f);
                }
                else if (wayPoint.get_name() == "CENTER")
                {
                    waitTime = Random.Range(-3f, 8f);
                }
            }
        }
        Object.Destroy(this.get_gameObject());
    }
예제 #5
0
    private IEnumerator DoQuestGacha()
    {
        Init();
        int display_rarity = 0;

        SetLinkCamera(true);
        int enemy_id = 0;

        EnemyTable.EnemyData enemy_data = null;
        if (MonoBehaviourSingleton <GachaManager> .I.gachaResult != null)
        {
            GachaResult.GachaReward reward       = MonoBehaviourSingleton <GachaManager> .I.gachaResult.reward[0];
            uint reward_quest_id                 = (uint)reward.itemId;
            QuestTable.QuestTableData quest_data = Singleton <QuestTable> .I.GetQuestData(reward_quest_id);

            if (quest_data != null)
            {
                enemy_data = Singleton <EnemyTable> .I.GetEnemyData((uint)quest_data.GetMainEnemyID());
            }
        }
        if (enemy_data == null)
        {
            if (enemy_id == 0)
            {
                enemy_id = 1101001;
            }
            enemy_data = Singleton <EnemyTable> .I.GetEnemyData((uint)enemy_id);
        }
        NPCLoader   npc_loader   = LoadNPC();
        EnemyLoader enemy_loader = null;

        if (enemy_data != null)
        {
            int displayAnimID = enemy_data.animId;
            OutGameSettingsManager.EnemyDisplayInfo displayInfo = MonoBehaviourSingleton <OutGameSettingsManager> .I.SearchEnemyDisplayInfoForGacha(enemy_data);

            int   modelID      = enemy_data.modelId;
            float displayScale = enemy_data.modelScale;
            if (displayInfo != null)
            {
                displayAnimID = displayInfo.animID;
                displayScale  = displayInfo.gachaScale;
            }
            enemy_loader = LoadEnemy(enemyPosition, modelID, displayAnimID, displayScale, enemy_data.baseEffectName, enemy_data.baseEffectNode);
            while (enemy_loader.isLoading)
            {
                yield return((object)null);
            }
            enemy_loader.ApplyGachaDisplayScaleToParentNode();
            CheckAndReplaceShader(enemy_loader);
            enemy_loader.get_gameObject().SetActive(false);
        }
        while (npc_loader.isLoading)
        {
            yield return((object)null);
        }
        LoadingQueue lo_queue = new LoadingQueue(this);

        CacheAudio(lo_queue);
        if (enemy_data != null)
        {
            CacheEnemyAudio(enemy_data, lo_queue);
        }
        while (lo_queue.IsLoading())
        {
            yield return((object)null);
        }
        PlayerAnimCtrl npc_anim = PlayerAnimCtrl.Get(npc_loader.animator, PLCA.IDLE_01, null, null, null);

        CreateNPCEffect(npc_loader.model);
        yield return((object)null);

        stageAnimator.set_cullingMode(0);
        stageAnimator.Rebind();
        targetRarity = MonoBehaviourSingleton <GachaManager> .I.GetMaxRarity().ToRarityExpressionID() + 1;

        if (targetRarity > 4)
        {
            targetRarity = 4;
        }
        stageAnimator.Play("StageAnim_Main");
        Play("MainAnim_Start", null, 0f);
        PlayEffect(startEffectPrefabs[0]);
        npc_anim.Play(PLCA.QUEST_GACHA, true);
        bool rankup3 = UpdateDisplayRarity(ref display_rarity);

        PlayAudio(AUDIO.OPENING_01);
        while (Step(0.5f))
        {
            yield return((object)null);
        }
        PlayAudio(AUDIO.OPENING_02);
        PlayAudio(AUDIO.OPENING_03);
        while (Step(1.4f))
        {
            yield return((object)null);
        }
        PlayAudio(AUDIO.OPENING_04);
        while (Step(2.6f))
        {
            yield return((object)null);
        }
        PlayAudio(AUDIO.DOOR_01);
        while (Step(3.2f))
        {
            yield return((object)null);
        }
        PlayAudio(AUDIO.DOOR_02);
        while (Step(3.38f))
        {
            yield return((object)null);
        }
        PlayAudio(AUDIO.MAGI_INTRO_01);
        while (Step(6.5f))
        {
            yield return((object)null);
        }
        npc_loader.get_gameObject().SetActive(false);
        PlayMeteorEffect(display_rarity);
        PlayAudio(AUDIO.METEOR_01);
        while (Step(7.5f))
        {
            yield return((object)null);
        }
        PlayMagicEffect(display_rarity, rankup3);
        PlayMagicAudio(display_rarity);
        rankup3 = UpdateDisplayRarity(ref display_rarity);
        PlayMeteorEffect(display_rarity);
        while (Step(8.5f))
        {
            yield return((object)null);
        }
        PlayMagicEffect(display_rarity, rankup3);
        PlayMagicAudio(display_rarity);
        rankup3 = UpdateDisplayRarity(ref display_rarity);
        PlayMeteorEffect(display_rarity);
        PlayAudio(AUDIO.METEOR_02);
        while (Step(9.5f))
        {
            yield return((object)null);
        }
        PlayMagicEffect(display_rarity, rankup3);
        PlayMagicAudio(display_rarity);
        while (Step(10.5f))
        {
            yield return((object)null);
        }
        if (enemy_loader != null)
        {
            enemy_loader.get_gameObject().SetActive(true);
        }
        if (!skip)
        {
            PlayEnemyAnimation(enemy_loader, "Base Layer.GACHA_SINGLE");
        }
        Play("MainAnim_End", null, 0f);
        UpdateDisplayRarity(ref display_rarity);
        PlayEndEffect(display_rarity);
        RARITY_TYPE rarity = MonoBehaviourSingleton <GachaManager> .I.GetMaxRarity();

        PlayAppearAudio(rarity, false);
        if (enemy_data != null)
        {
            PlayEnemyAudio(enemy_data, false);
        }
        while (Step(11.5f))
        {
            yield return((object)null);
        }
        while (Step(13f))
        {
            yield return((object)null);
        }
        if (skip)
        {
            while (MonoBehaviourSingleton <TransitionManager> .I.isChanging)
            {
                yield return((object)null);
            }
            PlayEnemyAnimation(enemy_loader, "Base Layer.IDLE");
            Time.set_timeScale(1f);
            if (MonoBehaviourSingleton <TransitionManager> .I.isTransing)
            {
                yield return((object)MonoBehaviourSingleton <TransitionManager> .I.In());
            }
        }
        else
        {
            skip = true;
        }
        Time.set_timeScale(1f);
        sectionCommandReceiver.OnEnd();
    }
예제 #6
0
    private IEnumerator DoQuestGacha()
    {
        m_isSkipAll = false;
        Init();
        SetLinkCamera(true);
        EnemyLoader[]               enemyLoaderList = new EnemyLoader[11];
        EnemyTable.EnemyData[]      enemy_datas     = new EnemyTable.EnemyData[11];
        QuestTable.QuestTableData[] quest_datas     = new QuestTable.QuestTableData[11];
        if (MonoBehaviourSingleton <GachaManager> .IsValid() && MonoBehaviourSingleton <GachaManager> .I.gachaResult != null)
        {
            int i = 0;
            for (int n2 = MonoBehaviourSingleton <GachaManager> .I.gachaResult.reward.Count; i < n2; i++)
            {
                GachaResult.GachaReward reward = MonoBehaviourSingleton <GachaManager> .I.gachaResult.reward[i];
                uint reward_quest_id           = (uint)reward.itemId;
                quest_datas[i] = Singleton <QuestTable> .I.GetQuestData(reward_quest_id);

                if (quest_datas[i] != null)
                {
                    enemy_datas[i] = Singleton <EnemyTable> .I.GetEnemyData((uint)quest_datas[i].GetMainEnemyID());

                    if (enemy_datas[i] == null)
                    {
                        Log.Error("EnemyTable[{0}] == null", quest_datas[i].GetMainEnemyID());
                    }
                }
                else
                {
                    Log.Error("QuestTable[{0}] == null", reward.itemId);
                    quest_datas[i] = new QuestTable.QuestTableData();
                    enemy_datas[i] = new EnemyTable.EnemyData();
                }
            }
        }
        NPCLoader npc_loader = LoadNPC();

        npc_loader.Load(Singleton <NPCTable> .I.GetNPCData(2).npcModelID, 0, false, true, SHADER_TYPE.NORMAL, null);
        int n = 0;

        for (int m = 11; n < m; n++)
        {
            float scale         = enemy_datas[n].modelScale;
            int   displayAnimID = enemy_datas[n].animId;
            int   modelID       = enemy_datas[n].modelId;
            OutGameSettingsManager.EnemyDisplayInfo displayInfo = MonoBehaviourSingleton <OutGameSettingsManager> .I.SearchEnemyDisplayInfoForGacha(enemy_datas[n]);

            if (displayInfo != null)
            {
                displayAnimID = displayInfo.animID;
                scale         = displayInfo.gachaScale;
            }
            enemyLoaderList[n] = LoadEnemy(enemyPositions[n], modelID, displayAnimID, scale, enemy_datas[n].baseEffectName, enemy_datas[n].baseEffectNode);
        }
        int l = 0;

        for (int k = 11; l < k; l++)
        {
            while (enemyLoaderList[l].isLoading)
            {
                yield return((object)null);
            }
            enemyLoaderList[l].ApplyGachaDisplayScaleToParentNode();
            CheckAndReplaceShader(enemyLoaderList[l]);
            enemyLoaderList[l].get_gameObject().SetActive(false);
        }
        LoadingQueue lo_queue = new LoadingQueue(this);

        CacheAudio(lo_queue);
        for (int j = 0; j < 11; j++)
        {
            CacheEnemyAudio(enemy_datas[j], lo_queue);
        }
        while (npc_loader.isLoading)
        {
            yield return((object)null);
        }
        while (lo_queue.IsLoading())
        {
            yield return((object)null);
        }
        PlayerAnimCtrl npc_anim = PlayerAnimCtrl.Get(npc_loader.animator, PLCA.IDLE_01, null, null, null);

        CreateNPCEffect(npc_loader.model);
        yield return((object)null);

        stageAnimator.set_cullingMode(0);
        stageAnimator.Rebind();
        stageAnimator.Play("StageAnim_Main");
        Play("MainAnim_Start", null, 0f);
        PlayEffect(startEffectPrefabs[0]);
        npc_anim.Play(PLCA.QUEST_GACHA, true);
        PlayAudio(AUDIO.OPENING_01);
        while (Step(0.5f))
        {
            yield return((object)null);
        }
        PlayAudio(AUDIO.OPENING_02);
        PlayAudio(AUDIO.OPENING_03);
        while (Step(1.4f))
        {
            yield return((object)null);
        }
        PlayAudio(AUDIO.OPENING_04);
        while (Step(2.6f))
        {
            yield return((object)null);
        }
        PlayAudio(AUDIO.DOOR_01);
        while (Step(3.2f))
        {
            yield return((object)null);
        }
        PlayAudio(AUDIO.DOOR_02);
        while (Step(3.38f))
        {
            yield return((object)null);
        }
        PlayAudio(AUDIO.MAGI_INTRO_01);
        while (Step(5.1f))
        {
            yield return((object)null);
        }
        PlayAudio(AUDIO.MAGI_INTRO_02);
        while (Step(5.5f))
        {
            yield return((object)null);
        }
        PlayEffect(startEffectPrefabs[1]);
        Transform[] magic_effects = (Transform[])new Transform[11];
        Transform[] end_effects   = (Transform[])new Transform[11];
        int         meteor_step   = 0;
        int         magic_step    = 0;
        int         max_step      = 11;

        time -= Time.get_deltaTime();
        while (meteor_step < max_step || magic_step < max_step)
        {
            time += Time.get_deltaTime();
            if (meteor_step < max_step && meteorTimings[meteor_step] <= time)
            {
                PlayEffect(magicCircles[meteor_step], meteorEffectPrefabs[quest_datas[meteor_step].rarity.ToRarityExpressionID()]);
                if (meteor_step == max_step - 1)
                {
                    PlayAudio(AUDIO.METEOR_01);
                }
                meteor_step++;
            }
            if (magic_step < max_step && magicTimings[magic_step] <= time)
            {
                magic_effects[magic_step] = PlayEffect(magicCircles[magic_step], magicEffectPrefabs[quest_datas[magic_step].rarity.ToRarityExpressionID()]);
                PlayMagicAudio((int)quest_datas[magic_step].rarity);
                magic_step++;
            }
            yield return((object)null);
        }
        int idx = magic_step - 1;

        if (idx < max_step && idx >= 0)
        {
            PlayMagicAudio((int)quest_datas[idx].rarity);
        }
        while (Step(13.5f))
        {
            yield return((object)null);
        }
        if (skip && !m_isSkipAll)
        {
            if (MonoBehaviourSingleton <TransitionManager> .I.isChanging)
            {
                yield return((object)null);
            }
            Time.set_timeScale(1f);
            skip = false;
            time = 13.5f;
            yield return((object)MonoBehaviourSingleton <TransitionManager> .I.In());

            sectionCommandReceiver.ActivateSkipButton();
        }
        ActivateFirstSkipFlag();
        int         end_step           = 0;
        float       end_time2          = 13.5f;
        float       end_step_time      = 1.5f;
        float       end_step_time_last = 2f;
        RARITY_TYPE rarity_type;

        while (true)
        {
            sectionCommandReceiver.OnHideRarity();
            PlayAudio(AUDIO.RARITY_EXPOSITION);
            if (end_step > 0)
            {
                int prevIndex = end_step - 1;
                if (enemyLoaderList[prevIndex] != null)
                {
                    enemyLoaderList[prevIndex].get_gameObject().SetActive(false);
                }
                if (magic_effects[prevIndex] != null)
                {
                    Object.Destroy(magic_effects[prevIndex].get_gameObject());
                    magic_effects[prevIndex] = null;
                }
                if (end_effects[prevIndex] != null)
                {
                    Object.Destroy(end_effects[prevIndex].get_gameObject());
                    end_effects[prevIndex] = null;
                }
            }
            EnemyLoader nowEnemyLoader = enemyLoaderList[end_step];
            nowEnemyLoader.get_gameObject().SetActive(true);
            if (!skip)
            {
                string stateName = "Base Layer.GACHA_11";
                if (end_step == enemyLoaderList.Length - 1)
                {
                    stateName = "Base Layer.GACHA_SINGLE";
                }
                PlayEnemyAnimation(nowEnemyLoader, stateName);
            }
            rarity_type = quest_datas[end_step].rarity;
            int effect_rarity = rarity_type.ToRarityExpressionID();
            if (rarity_type == RARITY_TYPE.SS)
            {
                effect_rarity = 3;
            }
            end_effects[end_step] = PlayEffect(magicCircles[end_step], endEffectPrefabs[effect_rarity]);
            Play($"MainAnim_End_{end_step + 1:D2}", null, 0f);
            bool is_short = end_step < 11;
            PlayAppearAudio(rarity_type, is_short);
            if (enemy_datas.Length > end_step)
            {
                PlayEnemyAudio(enemy_datas[end_step], is_short);
            }
            end_step++;
            if (end_step >= 11)
            {
                break;
            }
            float waitTime = 0f;
            while (waitTime < showRarityWaitTime)
            {
                waitTime += Time.get_deltaTime();
                if (base.IsSkipAppearEnemy)
                {
                    waitTime = showRarityWaitTime;
                }
                yield return((object)null);
            }
            if (!base.IsSkipAppearEnemy)
            {
                sectionCommandReceiver.OnShowRarity(rarity_type);
            }
            end_time2 += end_step_time;
            while (Step(end_time2))
            {
                if (base.IsSkipAppearEnemy)
                {
                    time = end_time2;
                }
                yield return((object)null);
            }
            sectionCommandReceiver.ActivateSkipButton();
            ResetSkipAppearEnemyFlag();
        }
        yield return((object)new WaitForSeconds(lastShowRarityWaitTime));

        sectionCommandReceiver.OnShowRarity(rarity_type);
        end_time2 += end_step_time_last;
        while (Step(end_time2))
        {
            yield return((object)null);
        }
        if (skip)
        {
            while (MonoBehaviourSingleton <TransitionManager> .I.isChanging)
            {
                yield return((object)null);
            }
            int lastIndex = enemyLoaderList.Length - 1;
            if (lastIndex >= 0)
            {
                PlayEnemyAnimation(enemyLoaderList[lastIndex], "Base Layer.IDLE");
            }
            Time.set_timeScale(1f);
            if (MonoBehaviourSingleton <TransitionManager> .I.isTransing)
            {
                yield return((object)MonoBehaviourSingleton <TransitionManager> .I.In());
            }
        }
        else
        {
            skip = true;
        }
        sectionCommandReceiver.OnHideRarity();
        Time.set_timeScale(1f);
        sectionCommandReceiver.OnEnd();
    }