Ejemplo n.º 1
0
        protected override IEnumerator TraverseSpecial(RichSpecial rs)
        {
            this.traversingSpecialPath = true;
            this.velocity = Vector3.zero;
            AnimationLink al = rs.nodeLink as AnimationLink;

            if (al == null)
            {
                Debug.LogError("Unhandled RichSpecial");
                yield break;
            }
            while (!this.RotateTowards(rs.first.forward))
            {
                yield return(null);
            }
            this.tr.parent.position = this.tr.position;
            this.tr.parent.rotation = this.tr.rotation;
            this.tr.localPosition   = Vector3.zero;
            this.tr.localRotation   = Quaternion.identity;
            if (rs.reverse && al.reverseAnim)
            {
                this.anim[al.clip].speed          = -al.animSpeed;
                this.anim[al.clip].normalizedTime = 1f;
                this.anim.Play(al.clip);
                this.anim.Sample();
            }
            else
            {
                this.anim[al.clip].speed = al.animSpeed;
                this.anim.Rewind(al.clip);
                this.anim.Play(al.clip);
            }
            this.tr.parent.position -= this.tr.position - this.tr.parent.position;
            yield return(new WaitForSeconds(Mathf.Abs(this.anim[al.clip].length / al.animSpeed)));

            this.traversingSpecialPath = false;
            base.NextPart();
            if (this.delayUpdatePath)
            {
                this.delayUpdatePath = false;
                this.UpdatePath();
            }
            yield break;
            yield break;
        }
        // Token: 0x06002A05 RID: 10757 RVA: 0x001C2AA3 File Offset: 0x001C0CA3
        protected virtual IEnumerator TraverseOffMeshLink(RichSpecial rs)
        {
            AnimationLink link = rs.nodeLink as AnimationLink;

            if (link == null)
            {
                Debug.LogError("Unhandled RichSpecial");
                yield break;
            }
            for (;;)
            {
                Quaternion rotation   = this.ai.rotation;
                Quaternion quaternion = this.ai.SimulateRotationTowards(rs.first.forward, this.ai.rotationSpeed * Time.deltaTime);
                if (rotation == quaternion)
                {
                    break;
                }
                this.ai.FinalizeMovement(this.ai.position, quaternion);
                yield return(null);
            }
            base.transform.parent.position = base.transform.position;
            base.transform.parent.rotation = base.transform.rotation;
            base.transform.localPosition   = Vector3.zero;
            base.transform.localRotation   = Quaternion.identity;
            if (rs.reverse && link.reverseAnim)
            {
                this.anim[link.clip].speed          = -link.animSpeed;
                this.anim[link.clip].normalizedTime = 1f;
                this.anim.Play(link.clip);
                this.anim.Sample();
            }
            else
            {
                this.anim[link.clip].speed = link.animSpeed;
                this.anim.Rewind(link.clip);
                this.anim.Play(link.clip);
            }
            base.transform.parent.position -= base.transform.position - base.transform.parent.position;
            yield return(new WaitForSeconds(Mathf.Abs(this.anim[link.clip].length / link.animSpeed)));

            yield break;
        }