Update() public method

public Update ( Vector3 position, List buffer, int numCorners, bool &lastCorner, bool &requiresRepath ) : Vector3
position UnityEngine.Vector3
buffer List
numCorners int
lastCorner bool
requiresRepath bool
return UnityEngine.Vector3
Esempio n. 1
0
        protected override Vector3 UpdateTarget(RichFunnel fn)
        {
            Matrix4x4 matrix  = this.graph.GetMatrix();
            Matrix4x4 inverse = matrix.inverse;

            Debug.DrawRay(matrix.MultiplyPoint3x4(this.tr.position), Vector3.up * 2f, Color.red);
            Debug.DrawRay(inverse.MultiplyPoint3x4(this.tr.position), Vector3.up * 2f, Color.green);
            this.nextCorners.Clear();
            Vector3 vector  = this.tr.position;
            Vector3 vector2 = matrix.MultiplyPoint3x4(vector);
            bool    flag;

            vector2 = fn.Update(vector2, this.nextCorners, 2, out this.lastCorner, out flag);
            vector  = inverse.MultiplyPoint3x4(vector2);
            Debug.DrawRay(vector, Vector3.up * 3f, Color.black);
            for (int i = 0; i < this.nextCorners.Count; i++)
            {
                this.nextCorners[i] = inverse.MultiplyPoint3x4(this.nextCorners[i]);
                Debug.DrawRay(this.nextCorners[i], Vector3.up * 3f, Color.yellow);
            }
            if (flag && !this.waitingForPathCalc)
            {
                this.UpdatePath();
            }
            return(vector);
        }
        protected override Vector3 UpdateTarget(RichFunnel fn)
        {
            bool      flag;
            Matrix4x4 matrix  = this.graph.GetMatrix();
            Matrix4x4 inverse = matrix.inverse;

            Debug.DrawRay(matrix.MultiplyPoint3x4(base.tr.position), (Vector3)(Vector3.up * 2f), Color.red);
            Debug.DrawRay(inverse.MultiplyPoint3x4(base.tr.position), (Vector3)(Vector3.up * 2f), Color.green);
            base.buffer.Clear();
            Vector3 position = base.tr.position;
            Vector3 vector2  = matrix.MultiplyPoint3x4(position);

            vector2  = fn.Update(vector2, base.buffer, 2, out this.lastCorner, out flag);
            position = inverse.MultiplyPoint3x4(vector2);
            Debug.DrawRay(position, (Vector3)(Vector3.up * 3f), Color.black);
            for (int i = 0; i < base.buffer.Count; i++)
            {
                base.buffer[i] = inverse.MultiplyPoint3x4(base.buffer[i]);
                Debug.DrawRay(base.buffer[i], (Vector3)(Vector3.up * 3f), Color.yellow);
            }
            if (flag && !base.waitingForPathCalc)
            {
                this.UpdatePath();
            }
            return(position);
        }
Esempio n. 3
0
	protected override Vector3 UpdateTarget (RichFunnel fn) {
		Matrix4x4 m = graph.GetMatrix();
		Matrix4x4 mi = m.inverse;


		Debug.DrawRay(m.MultiplyPoint3x4(tr.position), Vector3.up*2, Color.red);
		Debug.DrawRay(mi.MultiplyPoint3x4(tr.position), Vector3.up*2, Color.green);

		buffer.Clear();

		/* Current position. We read and write to tr.position as few times as possible since doing so
		 * is much slower than to read and write from/to a local variable
		 */
		Vector3 position = tr.position;
		bool requiresRepath;

		// Update, but first convert our position to graph space, then convert the result back to world space
		var positionInGraphSpace = m.MultiplyPoint3x4(position);
		positionInGraphSpace = fn.Update(positionInGraphSpace, buffer, 2, out lastCorner, out requiresRepath);
		position = mi.MultiplyPoint3x4(positionInGraphSpace);

		Debug.DrawRay(position, Vector3.up*3, Color.black);

		// convert the result to world space from graph space
		for (int i = 0; i < buffer.Count; i++) {
			buffer[i] = mi.MultiplyPoint3x4(buffer[i]);
			Debug.DrawRay(buffer[i], Vector3.up*3, Color.yellow);
		}

		if (requiresRepath && !waitingForPathCalc) {
			UpdatePath();
		}

		return position;
	}
Esempio n. 4
0
        // Token: 0x0600217A RID: 8570 RVA: 0x0018E360 File Offset: 0x0018C560
        protected virtual Vector3 UpdateTarget(RichFunnel fn)
        {
            this.nextCorners.Clear();
            bool    flag;
            Vector3 result = fn.Update(this.simulatedPosition, this.nextCorners, 2, out this.lastCorner, out flag);

            if (flag && !this.waitingForPathCalculation && this.canSearch)
            {
                this.SearchPath();
            }
            return(result);
        }
Esempio n. 5
0
		protected virtual Vector3 UpdateTarget(RichFunnel fn)
		{
			this.nextCorners.Clear();
			Vector3 vector = this.tr.position;
			bool flag;
			vector = fn.Update(vector, this.nextCorners, 2, out this.lastCorner, out flag);
			if (flag && !this.waitingForPathCalc)
			{
				this.UpdatePath();
			}
			return vector;
		}
Esempio n. 6
0
        protected virtual Vector3 UpdateTarget(RichFunnel fn)
        {
            nextCorners.Clear();

            // Current position. We read and write to tr.position as few times as possible since doing so
            // is much slower than to read and write from/to a local variable
            bool    requiresRepath;
            Vector3 position = fn.Update(tr.position, nextCorners, 2, out lastCorner, out requiresRepath);

            if (requiresRepath && !waitingForPathCalc)
            {
                UpdatePath();
            }

            return(position);
        }
        protected virtual Vector3 UpdateTarget(RichFunnel fn)
        {
            nextCorners.Clear();

            // This method assumes simulatedPosition is up to date as our current position.
            // We read and write to tr.position as few times as possible since doing so
            // is much slower than to read and write from/to a local/member variable.
            bool    requiresRepath;
            Vector3 position = fn.Update(simulatedPosition, nextCorners, 2, out lastCorner, out requiresRepath);

            if (requiresRepath && !waitingForPathCalculation && canSearch)
            {
                // TODO: What if canSearch is false? How do we notify other scripts that might be handling the path calculation that a new path needs to be calculated?
                SearchPath();
            }

            return(position);
        }
Esempio n. 8
0
		protected virtual Vector3 UpdateTarget ( RichFunnel fn ) {
			buffer.Clear ();
			/* Current position. We read and write to tr.position as few times as possible since doing so
			 * is much slower than to read and write from/to a local variable
			 */
			Vector3 position = tr.position;
			bool requiresRepath;
			position = fn.Update (position, buffer, 2, out lastCorner, out requiresRepath);
	
			if (requiresRepath && !waitingForPathCalc) {
				UpdatePath ();
			}
	
			return position;
		}
Esempio n. 9
0
 protected virtual Vector3 UpdateTarget(RichFunnel fn)
 {
     this.buffer.Clear();
     Vector3 vector = this.tr.position;
     bool flag;
     vector = fn.Update(vector, this.buffer, 2, out this.lastCorner, out flag);
     if (flag && !this.waitingForPathCalc)
     {
         this.UpdatePath();
     }
     return vector;
 }