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); }
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)); }
/// <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 }; } }
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); }
/// <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 }; } }
/// <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); }
/// <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); }
public AIMoveIntoRangeThenExecAction(Unit owner, SimpleRange range, UnitActionCallback actionCallback) : base(owner, actionCallback) { m_Range = range; }
public AIMoveIntoRangeOfGOThenExecAction(Unit owner, GameObject go, SimpleRange range, UnitActionCallback actionCallback) : base(owner, actionCallback) { _gameObject = go; m_Range = range; }