/* * // Try to select the node * public void OnTriggerEnter2D(Collider2D other) * { * if (other.tag == "Cursor") * { * if (currentCount > 0) * { * levelManager.SelectNode(gameObject); * } * } * }*/ private void UpdateColor() { if (spriteRenderer == null) { Debug.Log("No sprite renderer."); } if (currentCount == 3) { spriteRenderer.color = Color.red; currentColor = HitColor.RED; } else if (currentCount == 2) { spriteRenderer.color = Color.magenta; currentColor = HitColor.PURPLE; } else if (currentCount == 1) { spriteRenderer.color = Color.blue; currentColor = HitColor.BLUE; } else { spriteRenderer.color = Color.black; currentColor = HitColor.BLACK; } }
protected override void OnPaint(PaintEventArgs e) { var g = e.Graphics; if (Source != null) { float tileSize = Width / 10f; var unknown = new SolidBrush(Enabled ? UnknownColor : UnknownColor.HalveHue()); var hit = new SolidBrush(Enabled ? HitColor : HitColor.HalveHue()); var miss = new SolidBrush(Enabled ? MissColor : MissColor.HalveHue()); for (int x = 0; x < 10; x++) { for (int y = 0; y < 10; y++) { switch (Source[x, y]) { case TrackerTile.Unknown: g.FillRectangle(unknown, tileSize * x, tileSize * y, tileSize, tileSize); break; case TrackerTile.Miss: g.FillRectangle(miss, tileSize * x, tileSize * y, tileSize, tileSize); break; case TrackerTile.Hit: g.FillRectangle(hit, tileSize * x, tileSize * y, tileSize, tileSize); break; } } } } base.OnPaint(e); }
/* * // Try to select the node * public void OnTriggerEnter2D(Collider2D other) * { * if (other.tag == "Cursor") * { * if (currentCount > 0) * { * levelManager.SelectNode(gameObject); * } * } * }*/ private void UpdateColor() { if (leaveType == "EMPTY") { return; } if (currentCount == 3) { spriteRenderer.color = Color.red; currentColor = HitColor.RED; } else if (currentCount == 2) { spriteRenderer.color = Color.magenta; currentColor = HitColor.PURPLE; } else if (currentCount == 1) { spriteRenderer.color = Color.blue; currentColor = HitColor.BLUE; } else { spriteRenderer.color = Color.black; currentColor = HitColor.BLACK; } }
void Awake() { type = "SIMPLE"; maxCount = 0; currentCount = 0; row = 0; column = 0; currentColor = HitColor.BLACK; }
void Awake() { leaveType = "SIMPLE"; moveType = "STATIC"; specialType = "NONE"; countType = "NORMAL"; maxCount = 0; currentCount = 0; row = 0; column = 0; currentColor = HitColor.BLACK; }
protected override void OnPaint(PaintEventArgs e) { var g = e.Graphics; if (Source != null) { float tileSize = Width / 10f; var water = new SolidBrush(Enabled ? WaterColor : WaterColor.HalveHue()); var hit = new SolidBrush(Enabled ? HitColor : HitColor.HalveHue()); var miss = new SolidBrush(Enabled ? MissColor : MissColor.HalveHue()); var ship = new SolidBrush(Enabled ? ShipColor : ShipColor.HalveHue()); for (int x = 0; x < 10; x++) { for (int y = 0; y < 10; y++) { switch (Source[x, y]) { case PrimaryTile.Ship: g.FillRectangle(ship, tileSize * x, tileSize * y, tileSize, tileSize); break; case PrimaryTile.Miss: g.FillRectangle(miss, tileSize * x, tileSize * y, tileSize, tileSize); break; case PrimaryTile.Hit: g.FillRectangle(hit, tileSize * x, tileSize * y, tileSize, tileSize); break; case PrimaryTile.Water: g.FillRectangle(water, tileSize * x, tileSize * y, tileSize, tileSize); break; } } } } base.OnPaint(e); }