/// <summary> /// Creates a Circle to represent the attack radius of the AI. If the Position Component of the /// AI's target is within this Circle, then the AI is in range. /// </summary> /// <param name="entID">The Entity to check range for.</param> /// <param name="AI">AI component of the Entity to check range for.</param> /// <param name="pos">Position component of the Entity to check range for.</param> protected void CheckRange(ulong entID, CAI AI, CPosition pos) { Circle attackRadius = SwinGame.CreateCircle(pos.Centre.X, pos.Centre.Y, AI.Range + (pos.Width / 2)); CPosition targetPos = World.GetComponent <CPosition>(AI.TargetID); AI.IsInRange = SwinGame.CircleRectCollision(attackRadius, targetPos.Rect); }