当前位置: 首页>>代码示例>>C#>>正文


C# OnPathDelegate类代码示例

本文整理汇总了C#中OnPathDelegate的典型用法代码示例。如果您正苦于以下问题:C# OnPathDelegate类的具体用法?C# OnPathDelegate怎么用?C# OnPathDelegate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OnPathDelegate类属于命名空间,在下文中一共展示了OnPathDelegate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Setup

		protected void Setup (Vector3 start, Vector3[] targets, OnPathDelegate[] callbackDelegates, OnPathDelegate callback) {
			inverted = false;
			this.callback = callback;
			callbacks = callbackDelegates;
			
			targetPoints = targets;
			
			originalStartPoint = start;
			//originalEndPoint = end;
			
			startPoint = start;
			startIntPoint = (Int3)start;
			
			if (targets.Length == 0) {
				Error ();
				LogError ("No targets were assigned to the MultiTargetPath");
				return;
			}
			
			endPoint = targets[0];
			
			originalTargetPoints = new Vector3[targetPoints.Length];
			for (int i=0;i<targetPoints.Length;i++) {
				originalTargetPoints[i] = targetPoints[i];
			}
		}
开发者ID:moderndelta137,项目名称:Shadow_Sword,代码行数:26,代码来源:MultiTargetPath.cs

示例2: Construct

		public static FloodPath Construct (GraphNode start, OnPathDelegate callback = null) {
			if (start == null) throw new ArgumentNullException("start");

			var p = PathPool.GetPath<FloodPath>();
			p.Setup(start, callback);
			return p;
		}
开发者ID:Alx666,项目名称:ProjectPhoenix,代码行数:7,代码来源:FloodPath.cs

示例3: Construct

		public new static XPath Construct (Vector3 start, Vector3 end, OnPathDelegate callback = null) {
			var p = PathPool.GetPath<XPath>();

			p.Setup(start, end, callback);
			p.endingCondition = new ABPathEndingCondition(p);
			return p;
		}
开发者ID:Alx666,项目名称:ProjectPhoenix,代码行数:7,代码来源:XPath.cs

示例4: Setup

 protected void Setup(Vector3 start, Vector3 avoid, int searchLength, OnPathDelegate callback)
 {
     Setup (start, searchLength, callback);
     aim = avoid-start;
     aim *= 10;
     aim = start - aim;
 }
开发者ID:sonygod,项目名称:ESPUnity,代码行数:7,代码来源:FleePath.cs

示例5: Setup

		/** Sets up a ConstantPath starting from the specified point */
		protected void Setup (Vector3 start, int maxGScore, OnPathDelegate callback) {
			this.callback = callback;
			startPoint = start;
			originalStartPoint = startPoint;

			endingCondition = new EndingConditionDistance (this,maxGScore);
		}
开发者ID:smclallen,项目名称:Galactic_Parcel_Service,代码行数:8,代码来源:ConstantPath.cs

示例6: RandomPath

        public RandomPath(Vector3 start, int length, OnPathDelegate callbackDelegate = null)
        {
            callTime = System.DateTime.Now;

            callback = callbackDelegate;

            searchLength = length;

            if (AstarPath.active == null || AstarPath.active.graphs == null) {
                errorLog += "No NavGraphs have been calculated yet - Don't run any pathfinding calls in Awake";
                if (AstarPath.active.logPathResults != PathLog.None) {
                    Debug.LogError (errorLog);
                }
                error = true;
                return;
            }

            pathID = AstarPath.active.GetNextPathID ();

            originalStartPoint = start;
            originalEndPoint = Vector3.zero;

            startPoint = start;
            endPoint = Vector3.zero;

            startIntPoint = (Int3)start;
            hTarget = (Int3)aim;//(Int3)(start-aim);//new Int3(0,0,0);
            rnd = new System.Random ();
        }
开发者ID:Anaryu,项目名称:aetherion,代码行数:29,代码来源:RandomPath.cs

示例7: FloodPathTracer

 public FloodPathTracer(Vector3 start, FloodPath flood, OnPathDelegate callbackDelegate)
     : base(start,flood.originalStartPoint,callbackDelegate)
 {
     this.flood = flood;
     if (flood == null || !flood.processed)
         throw new System.ArgumentNullException ("You must supply a calculated FloodPath to the 'flood' argument");
     hasEndPoint = false;
     nnConstraint = new PathIDConstraint ();
 }
开发者ID:Anaryu,项目名称:aetherion,代码行数:9,代码来源:FloodPathTracer.cs

示例8: Setup

		protected void Setup (Vector3 start, FloodPath flood, OnPathDelegate callback) {
			this.flood = flood;

			if (flood == null || flood.GetState () < PathState.Returned) {
				throw new System.ArgumentException ("You must supply a calculated FloodPath to the 'flood' argument");
			}

			base.Setup (start, flood.originalStartPoint, callback);
			nnConstraint = new FloodPathConstraint (flood);
		}
开发者ID:luukholleman,项目名称:Airchitect,代码行数:10,代码来源:FloodPathTracer.cs

示例9: FleePath

        public FleePath(Vector3 start, Vector3 avoid, int length, OnPathDelegate callbackDelegate = null)
            : base(start,length,callbackDelegate)
        {
            /*if (AstarPath.active.heuristicScale == 0) {
                heuristicScale = -1;
            } else {
                heuristicScale = System.Math.Abs (AstarPath.active.heuristicScale) * -1;
            }*/

            originalEndPoint = avoid;

            endPoint = avoid;
            searchLength = length;
            hTarget = (Int3)avoid;
        }
开发者ID:Anaryu,项目名称:aetherion,代码行数:15,代码来源:FleePath.cs

示例10: MultiTargetPath

        public MultiTargetPath(Vector3 start, Vector3[] targets, OnPathDelegate[] callbackDelegates, OnPathDelegate callbackDelegate = null)
        {
            inverted = false;
            callback = callbackDelegate;
            callbacks = callbackDelegates;

            pathID = AstarPath.active.GetNextPathID ();

            if (AstarPath.active == null || AstarPath.active.graphs == null) {
                errorLog += "No NavGraphs have been calculated yet - Don't run any pathfinding calls in Awake";
                if (AstarPath.active.logPathResults != PathLog.None) {
                    Debug.LogError (errorLog);
                }
                error = true;
                return;
            }

            targetPoints = targets;

            originalStartPoint = start;
            //originalEndPoint = end;

            startPoint = start;
            startIntPoint = (Int3)start;

            if (targets.Length == 0) {
                error = true;
                errorLog += "No targets were assigned\n";
                return;
            }

            endPoint = targets[0];

            originalTargetPoints = new Vector3[targetPoints.Length];
            for (int i=0;i<targetPoints.Length;i++) {
                originalTargetPoints[i] = targetPoints[i];
            }

            //heuristic = Heuristic.Euclidean;//Heuristic.None;
            //heuristicScale = 1F;
        }
开发者ID:Anaryu,项目名称:aetherion,代码行数:41,代码来源:MultiTargetPath.cs

示例11: StartPath

	/** Call this function to start calculating a path.
	 * \param p			The path to start calculating
	 * \param callback	The function to call when the path has been calculated
	 * \param graphMask	Mask used to specify which graphs should be searched for close nodes. See Pathfinding.NNConstraint.graphMask. \astarproParam
	 * 
	 * \a callback will be called when the path has completed.
	 * \a Callback will not be called if the path is canceled (e.g when a new path is requested before the previous one has completed) */
	public Path StartPath (Path p, OnPathDelegate callback = null, int graphMask = -1) {
		p.enabledTags = traversableTags.tagsChange;
		p.tagPenalties = tagPenalties;
		
		//Cancel a previously requested path is it has not been processed yet and also make sure that it has not been recycled and used somewhere else
		if (path != null && path.GetState() <= PathState.Processing && lastPathID == path.pathID) {
			path.LogError ("Canceled path because a new one was requested\nGameObject: "+gameObject.name);
			//No callback should be sent for the canceled path
		}
		
		path = p;
		path.callback += onPathDelegate;
		
		tmpPathCallback = callback;
		
		//Set the Get Nearest Node hints if they have not already been set
		/*if (path.startHint == null)
			path.startHint = startHint;
			
		if (path.endHint == null) 
			path.endHint = endHint;
		*/
		
		//Save the path id so we can make sure that if we cancel a path (see above) it should not have been recycled yet.
		lastPathID = path.pathID;
		
		//Delay the path call by one frame if it was sent the same frame as the previous call
		/*if (lastPathCall == Time.frameCount) {
			StartCoroutine (DelayPathStart (path));
			return path;
		}*/
		
		//lastPathCall = Time.frameCount;
		
		//Pre process the path
		RunModifiers (ModifierPass.PreProcess, path);
		
		//Send the request to the pathfinder
		AstarPath.StartPath (path);
		
		return path;
	}
开发者ID:JustSAT,项目名称:Tower-Defence,代码行数:49,代码来源:Seeker.cs

示例12: XPath

 public XPath(Vector3 start, Vector3 end, OnPathDelegate callbackDelegate)
 {
     Setup (start, end, callbackDelegate);
 }
开发者ID:ChasmGamesProject,项目名称:UnityGameRepository,代码行数:4,代码来源:XPath.cs

示例13: Reset

        public virtual void Reset(Vector3 start, Vector3 end, OnPathDelegate callbackDelegate, bool reset = true)
        {
            if (reset)
            {
                processed = false;
                vectorPath = null;
                path = null;
                next = null;
                foundEnd = false;
                error = false;
                errorLog = "";
                callback = null;
                current = null;
                duration = 0;
                searchIterations = 0;
                searchedNodes = 0;

                startHint = null;
                endHint = null;
            }

            callTime = System.DateTime.Now;

            callback = callbackDelegate;

            if (AstarPath.active == null || AstarPath.active.graphs == null)
            {
                errorLog += "No NavGraphs have been calculated yet - Don't run any pathfinding calls in Awake";
                if (AstarPath.active.logPathResults != PathLog.None)
                {
                    Debug.LogWarning(errorLog);
                }
                error = true;
                return;
            }

            pathID = AstarPath.active.GetNextPathID();

            UpdateStartEnd(start, end);

            heuristic = AstarPath.active.heuristic;
            heuristicScale = AstarPath.active.heuristicScale;
        }
开发者ID:AlexisHenriquezB,项目名称:SpaceMooney,代码行数:43,代码来源:Path.cs

示例14: XPath

		public XPath (Vector3 start, Vector3 end, OnPathDelegate callbackDelegate) : base (start,end,callbackDelegate) {}
开发者ID:pravusjif,项目名称:PravusUnityTests,代码行数:1,代码来源:XPath.cs

示例15: StartMultiTargetPath

	/** Starts a Multi Target Path. Takes a MultiTargetPath and wires everything up for it to send callbacks to the seeker for post-processing.\n
	 * \param p				The path to start calculating
	 * \param callback		The function to call when the path has been calculated
	 * \param graphMask	Mask used to specify which graphs should be searched for close nodes. See Pathfinding.NNConstraint.graphMask. \astarproParam
	 * 
	 * \a callback and #pathCallback will be called when the path has completed. \a Callback will not be called if the path is canceled (e.g when a new path is requested before the previous one has completed)
	 * \astarpro
	 * \see Pathfinding.MultiTargetPath
	 * \see \ref MultiTargetPathExample.cs "Example of how to use multi-target-paths"
	 */
	public MultiTargetPath StartMultiTargetPath (MultiTargetPath p, OnPathDelegate callback = null, int graphMask = -1) {
			
		//Cancel a previously requested path is it has not been processed yet and also make sure that it has not been recycled and used somewhere else
		if (path != null && path.GetState () <= PathState.Processing && lastPathID == path.pathID) {
			path.ForceLogError ("Canceled path because a new one was requested");
			//No callback should be sent for the canceled path
		}
		
		OnPathDelegate[] callbacks = new OnPathDelegate[p.targetPoints.Length];
		for (int i=0;i<callbacks.Length;i++) {
			callbacks[i] = onPartialPathDelegate;
		}
		
		p.callbacks = callbacks;
		p.callback += OnMultiPathComplete;
		p.nnConstraint.graphMask = graphMask;
		
		path = p;
		
		tmpPathCallback = callback;
		
		//Save the path id so we can make sure that if we cancel a path (see above) it should not have been recycled yet.
		lastPathID = path.pathID;
		
		//Delay the path call by one frame if it was sent the same frame as the previous call
		/*if (lastPathCall == Time.frameCount) {
			StartCoroutine (DelayPathStart (path));
			return p;
		}
		
		lastPathCall = Time.frameCount;*/
		
		//Pre process the path
		RunModifiers (ModifierPass.PreProcess, path);
		
		//Send the request to the pathfinder
		AstarPath.StartPath (path);
		
		return p;
	}
开发者ID:Gapti,项目名称:ClashOfClanRIP,代码行数:50,代码来源:Seeker.cs


注:本文中的OnPathDelegate类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。