IEnumerator PutinMove1() { yield return(new WaitForSeconds(1f)); animator.Play("Putin_sit_to_stand"); yield return(new WaitForSeconds(2f)); animator.Play("Putin_idle"); yield return(new WaitForSeconds(0.5f)); List <Vector3> path = new List <Vector3>(); foreach (var pathTransform in pathTransforms) { path.Add(pathTransform.position); } Vector3[] pathArray = path.ToArray(); TweenerCore <Vector3, Path, PathOptions> tween = transform.DOPath(pathArray, 4, PathType.CatmullRom, PathMode.Full3D).OnStart(() => { animator.Play("putinWalking"); }).OnComplete(() => { animator.Play("Putin_idle"); }).SetLookAt(0.001f, -transform.forward, transform.up).SetEase(Ease.Linear).SetAutoKill(false); yield return(new WaitForSeconds(10f)); Scene1Manager.instance.isPutinTalked = true; tween.PlayBackwards(); tween.SetLookAt(0.001f, transform.forward, transform.up); animator.Play("putinWalking"); yield return(new WaitForSeconds(4.2f)); animator.Play("Putin_idle"); transform.DORotate(new Vector3(0, 180, 0), 1f).OnComplete(() => { animator.Play("Putin_sit"); }); }
public void play(Unit unit, string pathName, bool autoPaly, bool inverse) { start(unit); Vector3[] path = iTweenPath.GetPath(pathName); if (inverse) { System.Array.Reverse(path); } Vector3 d = path[0] - vTarget; for (int i = 0; i < path.Length; ++i) { path[i] = path[i] - d; } mPathTween = unit.transform.DOPath(path, mSpeed, PathType.CatmullRom, PathMode.Full3D); if (!autoPaly) { mPathTween.Pause(); } mPathTween.SetSpeedBased(true); mPathTween.timeScale = unit.scale; mPathTween.SetLookAt(0).SetEase(Ease.Linear).OnWaypointChange(onWaypointChange).OnComplete(delegate { mPathTween = null; }); }