コード例 #1
0
        /// <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);
        }
コード例 #2
0
 public override void Draw()
 {
     _shape = SwinGame.CreateCircle(_x, _y, ALIEN_SIZE - 5);
     if (_visible)
     {
         SwinGame.FillRectangle(_colour, _x - ALIEN_SIZE, _y - ALIEN_SIZE, ALIEN_SIZE * 2, ALIEN_SIZE * 2);
         SwinGame.FillCircle(GetColorFromLives(), _shape);
     }
     _missiles.DrawAll();
 }
コード例 #3
0
 public override bool IsAt(Point2D pt)
 {
     return(SwinGame.PointInCircle(pt, SwinGame.CreateCircle(this.X, this.Y, _radius)));
 }
コード例 #4
0
 public override void Draw()
 {
     _shape = SwinGame.CreateCircle(_x, _y, GetRadius());
     SwinGame.FillCircle(_colour, _shape);
 }