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