예제 #1
0
		public bool IsInRadius(WorldObject obj, SimpleRange range)
		{
			var distSq = GetDistanceSq(obj);
			return distSq <= range.MaxDist * range.MaxDist &&
				(range.MinDist < 1 || distSq >= range.MinDist * range.MinDist);
		}
예제 #2
0
		public bool IsInRange(SimpleRange range, WorldObject obj)
		{
			var distSq = GetDistanceSq(obj);
			return (distSq <= range.MaxDist * range.MaxDist &&
					 (range.MinDist < 1 || distSq >= range.MinDist * range.MinDist));
		}
예제 #3
0
파일: Unit.AI.cs 프로젝트: KroneckerX/WCell
		/// <summary>
		/// Moves to the given target and once within the given range, executes the given action
		/// </summary>
		/// <remarks>Requires Brain</remarks>
		public void MoveToThenExecute(GameObject go, SimpleRange range, UnitActionCallback actionCallback, int millisTimeout)
		{
			if (CheckBrain())
			{
				m_brain.CurrentAction = new AIMoveIntoRangeOfGOThenExecAction(this, go, range, actionCallback)
				{
					TimeoutMillis = millisTimeout
				};
			}
		}
예제 #4
0
		public bool IsInRadius(ref Vector3 pt, SimpleRange range)
		{
			var distSq = GetDistanceSq(ref pt);
			return distSq <= range.MaxDist * range.MaxDist &&
				(range.MinDist < 1 || distSq >= range.MinDist * range.MinDist);
		}
예제 #5
0
파일: Unit.AI.cs 프로젝트: KroneckerX/WCell
		/// <summary>
		/// Moves to the given target and once within the given range, executes the given action
		/// </summary>
		/// <remarks>Requires Brain</remarks>
		public void MoveToThenExecute(Unit unit, SimpleRange range, UnitActionCallback actionCallback, int millisTimeout)
		{
			if (CheckBrain())
			{
				//m_brain.StopCurrentAction();
				Target = unit;
				m_brain.CurrentAction = new AIMoveIntoRangeThenExecAction(this, range, actionCallback)
				{
					TimeoutMillis = millisTimeout
				};
			}
		}
예제 #6
0
파일: Unit.AI.cs 프로젝트: KroneckerX/WCell
		/// <summary>
		/// Moves to the given target and once within the given range, executes the given action
		/// </summary>
		/// <remarks>Requires Brain</remarks>
		public void MoveToThenExecute(GameObject go, SimpleRange range, UnitActionCallback actionCallback)
		{
			MoveToThenExecute(go, range, actionCallback, 0);
		}
예제 #7
0
파일: Unit.AI.cs 프로젝트: KroneckerX/WCell
		/// <summary>
		/// Moves to the given target and once within the given range, executes the given action
		/// </summary>
		/// <remarks>Requires Brain</remarks>
		public void MoveToThenExecute(Unit unit, SimpleRange range, UnitActionCallback actionCallback)
		{
			MoveToThenExecute(unit, range, actionCallback, 0);
		}
예제 #8
0
		public AIMoveIntoRangeThenExecAction(Unit owner, SimpleRange range, UnitActionCallback actionCallback)
			: base(owner, actionCallback)
		{
			m_Range = range;
		}
예제 #9
0
		public AIMoveIntoRangeOfGOThenExecAction(Unit owner, GameObject go, SimpleRange range, UnitActionCallback actionCallback)
			: base(owner, actionCallback)
		{
			_gameObject = go;
			m_Range = range;
		}