protected override void InitAnim()
    {
        PLCA   default_anim = PLCA.IDLE_01;
        string loopAnim     = npcInfo.GetLoopAnim();

        if (!string.IsNullOrEmpty(loopAnim))
        {
            default_anim = PlayerAnimCtrl.StringToEnum(loopAnim);
        }
        animCtrl = PlayerAnimCtrl.Get(animator, default_anim, OnAnimPlay, null, base.OnAnimEnd);
    }
예제 #2
0
    private void CompleteStoryNPCLoading(NPCTable.NPCData npc_data)
    {
        //IL_0021: Unknown result type (might be due to invalid IL or missing references)
        //IL_0040: Unknown result type (might be due to invalid IL or missing references)
        //IL_0084: Unknown result type (might be due to invalid IL or missing references)
        PLCA default_anim = PlayerAnimCtrl.StringToEnum(npc_data.anim);

        model.set_localPosition(new Vector3(0f, -1.5f, 1.5f));
        model.set_localEulerAngles(new Vector3(0f, 180f, 0f));
        PlayerAnimCtrl.Get(loader.animator, default_anim, null, null, null);
        EnableRenderTexture(UI.TEX_ENEMY);
        SetActive((Enum)UI.OBJ_LOADING, false);
        GetCtrl(UI.SPR_LOAD_ROTATE_CIRCLE).set_localRotation(Quaternion.get_identity());
        loadComplete = true;
    }
예제 #3
0
 private void WaitInFreeMove()
 {
     waitTime -= Time.get_deltaTime();
     if (!string.IsNullOrEmpty(wayPoint.waitAnimStateName))
     {
         PLCA anim = PlayerAnimCtrl.StringToEnum(wayPoint.waitAnimStateName);
         animCtrl.Play(anim, false);
     }
     else if (this is LoungeMoveNPC)
     {
         animCtrl.PlayDefault(false);
     }
     else
     {
         animCtrl.PlayIdleAnims(sexType, false);
     }
 }
예제 #4
0
    public static StoryCharacter Initialize(int id, UITexture ui_tex, string _name, string _dir, string idle_anim)
    {
        //IL_0056: Unknown result type (might be due to invalid IL or missing references)
        //IL_00cf: Unknown result type (might be due to invalid IL or missing references)
        //IL_00e3: Expected O, but got Unknown
        //IL_00f9: Unknown result type (might be due to invalid IL or missing references)
        //IL_00fe: Expected O, but got Unknown
        NPCTable.NPCData nPCData = Singleton <NPCTable> .I.GetNPCData(_name);

        if (nPCData == null)
        {
            return(null);
        }
        UIRenderTexture uIRenderTexture = UIRenderTexture.Get(ui_tex, -1f, true, -1);

        uIRenderTexture.Disable();
        uIRenderTexture.nearClipPlane = 1f;
        uIRenderTexture.farClipPlane  = 100f;
        Transform      val            = Utility.CreateGameObject("StoryModel", uIRenderTexture.modelTransform, uIRenderTexture.renderLayer);
        StoryCharacter storyCharacter = val.get_gameObject().AddComponent <StoryCharacter>();

        storyCharacter.model     = val;
        storyCharacter.id        = id;
        storyCharacter.renderTex = uIRenderTexture;
        storyCharacter.uiTex     = ui_tex;
        storyCharacter.charaName = _name;
        storyCharacter.aliasName = string.Empty;
        storyCharacter.SetStandPosition(_dir, false);
        if (string.IsNullOrEmpty(idle_anim))
        {
            storyCharacter.idleAnim = PlayerAnimCtrl.StringToEnum(nPCData.anim);
        }
        else
        {
            storyCharacter.idleAnim = PlayerAnimCtrl.StringToEnum(idle_anim);
        }
        storyCharacter.isLoading = true;
        ModelLoaderBase modelLoaderBase = nPCData.LoadModel(val.get_gameObject(), false, false, storyCharacter.OnModelLoadComplete, false);

        storyCharacter.npcLoader = (modelLoaderBase as NPCLoader);
        storyCharacter.CollectTween(ui_tex.get_transform());
        return(storyCharacter);
    }
예제 #5
0
    private void OpenMessage(Animator animator)
    {
        //IL_0032: Unknown result type (might be due to invalid IL or missing references)
        //IL_0048: Unknown result type (might be due to invalid IL or missing references)
        //IL_00b2: Unknown result type (might be due to invalid IL or missing references)
        //IL_00bc: Unknown result type (might be due to invalid IL or missing references)
        isLoading = false;
        Open(UITransition.TYPE.OPEN);
        if (needUpdateAnchors)
        {
            needUpdateAnchors = false;
            UpdateAnchors();
        }
        model.set_localPosition(message.pos);
        model.set_localEulerAngles(message.rot);
        if (animator != null)
        {
            PlayerAnimCtrl.Get(animator, PlayerAnimCtrl.StringToEnum(npcData.anim), null, null, null);
        }
        EnableRenderTexture(targetTex);
        string replaceText = message.GetReplaceText();

        SetColor((Enum)UI.SPR_MESSAGE, (!isShowMessage || string.IsNullOrEmpty(replaceText)) ? Color.get_clear() : Color.get_white());
        isShowMessage = true;
        SetLabelText((Enum)UI.LBL_MESSAGE, replaceText);
        string displayName = npcData.displayName;

        SetLabelText((Enum)UI.LBL_NAME, displayName);
        if (message.has_voice)
        {
            SoundManager.PlayVoice(message.voice_id, 1f, 0u, null, null);
        }
        if (targetTex == UI.TEX_QUEST_NPC)
        {
            InitUITweener <TweenColor>((Enum)UI.TEX_QUEST_NPC, true, (EventDelegate.Callback)DeleteModel);
            InitUITweener <TweenColor>((Enum)UI.SPR_MESSAGE, true, (EventDelegate.Callback)null);
        }
    }
예제 #6
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());
    }