• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# OnPathDelegate类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: 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;
		
#if !AstarFree && FALSE
		//In case a multi target path has been specified, call special logic
		if (p.GetType () == typeof (MultiTargetPath)) {
			return StartMultiTargetPath (p as MultiTargetPath,callback);
		}
#endif
		//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.Error();
			path.LogError ("Canceled path because a new one was requested.\n"+
				"This happens when a new path is requested from the seeker when one was already being calculated.\n" +
				"For example if a unit got a new order, you might request a new path directly instead of waiting for the now" +
				" invalid path to be calculated. Which is probably what you want.\n" +
				"If you are getting this a lot, you might want to consider how you are scheduling path requests.");
			//No callback should be sent for the canceled path
		}
		
		path = p;
		path.callback += onPathDelegate;
		path.nnConstraint.graphMask = graphMask;
		
		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:Gapti,项目名称:ClashOfClanRIP,代码行数:61,代码来源:Seeker.cs


示例17: Construct

		/** Constructs a ConstantPath starting from the specified point.
		 * \param start 			From where the path will be started from (the closest node to that point will be used)
		 * \param maxGScore			Searching will be stopped when a node has a G score greater than this
		 * \param callback			Will be called when the path has completed, leave this to null if you use a Seeker to handle calls
		 *
		 * Searching will be stopped when a node has a G score (cost to reach it) greater than \a maxGScore */
		public static ConstantPath Construct (Vector3 start, int maxGScore, OnPathDelegate callback = null) {
			ConstantPath p = PathPool<ConstantPath>.GetPath ();
			p.Setup (start,maxGScore,callback);
			return p;
		}
开发者ID:smclallen,项目名称:Galactic_Parcel_Service,代码行数:11,代码来源:ConstantPath.cs


示例18: Construct

		/** Construct a path with a start and end point.
		 * The delegate will be called when the path has been calculated.
		 * Do not confuse it with the Seeker callback as they are sent at different times.
		 * If you are using a Seeker to start the path you can set \a callback to null.
		 *
		 * \returns The constructed path object
		 */
		public static ABPath Construct (Vector3 start, Vector3 end, OnPathDelegate callback = null) {
			ABPath p = PathPool<ABPath>.GetPath ();
			p.Setup (start, end, callback);
			return p;
		}
开发者ID:SpacesAdventure,项目名称:Kio-2,代码行数:12,代码来源:ABPath.cs


示例19: Setup

		protected void Setup (Vector3 start, Vector3 end, OnPathDelegate callbackDelegate) {
			callback = callbackDelegate;
			UpdateStartEnd (start,end);
		}
开发者ID:SpacesAdventure,项目名称:Kio-2,代码行数:4,代码来源:ABPath.cs


示例20: Construct

 public static FloodPathTracer Construct(Vector3 start, FloodPath flood, OnPathDelegate callback = null)
 {
     FloodPathTracer path = PathPool<FloodPathTracer>.GetPath();
     path.Setup(start, flood, callback);
     return path;
 }
开发者ID:GameDiffs,项目名称:TheForest,代码行数:6,代码来源:FloodPathTracer.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# OnValueChangeEventArgs类代码示例发布时间:2022-05-24
下一篇:
C# OnPacketReceive类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap