public void PlayAnim(PLCA anim)
 {
     if (!(animCtrl == null))
     {
         animCtrl.Play(anim, false);
     }
 }
 private void OnAnimEnd(PlayerAnimCtrl anim_ctrl, PLCA anim)
 {
     if (animEndCallback != null)
     {
         animEndCallback();
     }
 }
Exemplo n.º 3
0
 public void Play(PLCA anim, bool instant)
 {
     if (animCtrl == null)
     {
         InitAnim();
     }
     animCtrl.Play(anim, instant);
 }
    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);
    }
 protected override void OnAnimPlay(PlayerAnimCtrl anim_ctrl, PLCA anim)
 {
     if (anim == PLCA.WALK)
     {
         animator.set_applyRootMotion(true);
     }
     else
     {
         animator.set_applyRootMotion((anim == anim_ctrl.moveAnim) ? true : false);
     }
 }
Exemplo n.º 6
0
 protected void OnAnimEnd(PlayerAnimCtrl anim_ctrl, PLCA anim)
 {
     if (this is LoungeMoveNPC)
     {
         animCtrl.PlayDefault(false);
     }
     else
     {
         animCtrl.PlayIdleAnims(sexType, false);
     }
 }
 public void Play(PLCA anim, bool instant = false)
 {
     //IL_0044: Unknown result type (might be due to invalid IL or missing references)
     //IL_0049: Unknown result type (might be due to invalid IL or missing references)
     //IL_0051: Unknown result type (might be due to invalid IL or missing references)
     //IL_0056: Unknown result type (might be due to invalid IL or missing references)
     if (playingAnim == anim)
     {
         lastAnimHash = 0;
     }
     else
     {
         if (instant)
         {
             PlayAnimator(anim, instant);
         }
         else if (loopAnimHash != 0 && endAnimHash != 0)
         {
             AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
             AnimatorStateInfo nextAnimatorStateInfo    = animator.GetNextAnimatorStateInfo(0);
             if (currentAnimatorStateInfo.get_fullPathHash() == loopAnimHash || nextAnimatorStateInfo.get_fullPathHash() == loopAnimHash)
             {
                 animator.CrossFade(endAnimHash, transitionDuration, 0);
                 lastAnimHash    = endAnimHash;
                 lastPlayingAnim = playingAnim;
             }
         }
         string str = animStateNames[(int)anim];
         viaAnimHash = Animator.StringToHash("Base Layer." + str + "_VIA");
         if (!animator.HasState(0, viaAnimHash))
         {
             viaAnimHash = 0;
         }
         loopAnimHash = Animator.StringToHash("Base Layer." + str + "_LOOP");
         if (!animator.HasState(0, loopAnimHash))
         {
             loopAnimHash = 0;
         }
         if (loopAnimHash != 0)
         {
             endAnimHash = Animator.StringToHash("Base Layer." + str + "_END");
             if (!animator.HasState(0, endAnimHash))
             {
                 endAnimHash = 0;
             }
         }
         playingAnim = anim;
         if (onPlay != null)
         {
             onPlay(this, anim);
         }
     }
 }
Exemplo n.º 8
0
    private void StandUp()
    {
        base.CurrentActionType = LOUNGE_ACTION_TYPE.STAND_UP;
        SendStandUp();
        chairPoint.ResetSittingCharacter();
        PLCA anim = (sexType != 0) ? PLCA.STAND_UP_F : PLCA.STAND_UP;

        animCtrl.Play(anim, false);
        MonoBehaviourSingleton <LoungeManager> .I.HomeCamera.ChangeView(HomeCamera.VIEW_MODE.NORMAL);

        isSitting = false;
    }
    public bool IsPlaying(PLCA[] anims)
    {
        PLCA playingAnim = this.playingAnim;
        int  i           = 0;

        for (int num = anims.Length; i < num; i++)
        {
            if (anims[i] == playingAnim)
            {
                return(true);
            }
        }
        return(false);
    }
Exemplo n.º 10
0
 private void PlayAnimator(PLCA anim, bool instant = false)
 {
     if (animator.HasState(0, animStateHashs[(int)anim]))
     {
         string text = animStateNames[(int)anim];
         if (instant)
         {
             animator.Play(text);
         }
         else
         {
             animator.CrossFade(text, transitionDuration, 0);
         }
     }
 }
Exemplo n.º 11
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);
         }
     }
 }
Exemplo n.º 12
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;
    }
Exemplo n.º 13
0
    public bool IsCurrentState(PLCA anim)
    {
        //IL_001f: Unknown result type (might be due to invalid IL or missing references)
        //IL_0024: Unknown result type (might be due to invalid IL or missing references)
        if (PLCA.NORMAL > anim || (int)anim >= animStateHashs.Length)
        {
            return(false);
        }
        AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);

        if (currentAnimatorStateInfo.get_fullPathHash() != animStateHashs[(int)anim])
        {
            return(false);
        }
        return(true);
    }
Exemplo n.º 14
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);
     }
 }
 private void OnAnimChange(PlayerAnimCtrl anim_ctrl, PLCA anim)
 {
     //IL_003f: Unknown result type (might be due to invalid IL or missing references)
     //IL_006b: Unknown result type (might be due to invalid IL or missing references)
     if (!(loader == null))
     {
         bool active = anim_ctrl.IsPlaying(PlayerAnimCtrl.battleAnims);
         if (loader.wepL != null)
         {
             loader.wepL.get_gameObject().SetActive(active);
         }
         if (loader.wepR != null)
         {
             loader.wepR.get_gameObject().SetActive(active);
         }
     }
 }
    protected virtual IEnumerator DoSit()
    {
        isPlayingSitAnimation = true;
        chairPoint.SetSittingCharacter(this);
        Vector3 sitPos = chairPoint.get_transform().get_position();

        while (true)
        {
            animCtrl.Play(PLCA.WALK, false);
            Vector3    pos          = base._transform.get_position();
            Vector3    diff         = sitPos - pos;
            Vector2    val          = diff.ToVector2XZ();
            Vector2    dir          = val.get_normalized();
            Quaternion val2         = Quaternion.LookRotation(dir.ToVector3XZ());
            Vector3    eulerAngles  = val2.get_eulerAngles();
            float      rot2         = eulerAngles.y;
            float      vel          = 0f;
            Vector3    eulerAngles2 = base._transform.get_eulerAngles();
            rot2 = Mathf.SmoothDampAngle(eulerAngles2.y, rot2, ref vel, 0.1f);
            base._transform.set_eulerAngles(new Vector3(0f, rot2, 0f));
            if (diff.get_magnitude() < 0.15f)
            {
                break;
            }
            yield return((object)null);
        }
        Vector3    dirPoint = chairPoint.dir.get_transform().get_position();
        Vector3    sitDir   = dirPoint - sitPos;
        Quaternion sitRot   = Quaternion.LookRotation(sitDir);

        base._transform.set_rotation(sitRot);
        PLCA sitMotion = (sexType != 0) ? PLCA.SIT_F : PLCA.SIT;

        animCtrl.Play(sitMotion, false);
        while (true)
        {
            AnimatorStateInfo currentAnimatorStateInfo = animCtrl.animator.GetCurrentAnimatorStateInfo(0);
            if (!(1f > currentAnimatorStateInfo.get_normalizedTime()))
            {
                break;
            }
            yield return((object)null);
        }
        isPlayingSitAnimation = false;
    }
Exemplo n.º 17
0
    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);
    }
Exemplo n.º 18
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());
    }
Exemplo n.º 19
0
 protected virtual void OnAnimPlay(PlayerAnimCtrl anim_ctrl, PLCA anim)
 {
     animator.set_applyRootMotion((anim == anim_ctrl.moveAnim) ? true : false);
 }
    protected void InitAnim()
    {
        PLCA default_anim = PLCA.IDLE_02;

        animCtrl = PlayerAnimCtrl.Get(animator, default_anim, null, null, null);
    }