public void paint(Drawer drawer, bool selected) { if (mAlive) { if (selected) { drawer.drawEllipse(new Pen(mPlayer.mColor, 3), mPos.getValue(), mSize); } else { drawer.drawEllipse(new Pen(mPlayer.mColor, 2), mPos.getValue(), mSize); } } else { if (mDeadProc < 1) { drawer.drawExplose(new Pen(mPlayer.mColor, 2), mPos.getValue(), mSize / 2, mDeadProc); } } }
internal void paint(Drawer drawer, bool selected) { Color color = Color.Black; if (mPair.mFirst.hasFishka()) { color = mPair.mFirst.getFishka().mPlayer.mColor; } if (mAlive) { Pen pen = new Pen(color); if (selected) { pen = new Pen(color, 3); } if (!isCycle()) { Vec delta2 = mVecPair.mSecond - mVecPair.mFirst; Vec vec2 = delta2.norm(); Vec p1 = mVecPair.mSecond - vec2 * W + vec2.rotate() * W / 2; Vec p2 = mVecPair.mSecond - vec2 * W - vec2.rotate() * W / 2; drawer.drawLine(pen, mVecPair.mFirst, mVecPair.mSecond); drawer.drawLine(pen, p1, mVecPair.mSecond); drawer.drawLine(pen, p2, mVecPair.mSecond); drawer.drawEllipse(pen, getCenter(), W / 3); } else { drawer.drawEllipse(pen, mVecPair.mFirst, W); } } else { if (mDeadProc < 1) { if (isCycle()) { drawer.drawExplose(new Pen(color, 1), mVecPair.mFirst, W / 2, mDeadProc); } else { const int PART = 10; const double PART_1 = 1.0 / PART; for (int i = 0; i < PART; i++) { Vec delta2 = mVecPair.mSecond - mVecPair.mFirst; Vec vec2 = delta2.norm(); Vec p1 = mVecPair.mFirst + vec2 * W; Vec p2 = mVecPair.mSecond - vec2 * W; double a = i * PART_1 + mDeadProc * PART_1 / 2; double b = (i + 1) * PART_1 - mDeadProc * PART_1 / 2; drawer.drawLine(new Pen(color, 1), p1.interpolate(p2, a), p1.interpolate(p2, b)); } } } } }