public void FirstLoad() { uint color = (unchecked ((uint)((255 << 24) + (255 << 16) + (255 << 8) + 255))); PaintBucket pb = new PaintBucket(this, 1, color); pb.ChangeAll(); }
private void ConsumeItems(Mobile owner) { Container pack = owner.Backpack; Item canvas = pack.FindItemByType <Canvas>(); canvas.Consume(m_PaintingConsumer.CanvasCount); PaintBucket paintBucket = pack.FindItemByType <PaintBucket>(); paintBucket.Consume(m_PaintingConsumer.PaintBrushCount); }
void FindClosetBucket () { if (currentBrushe == null) return; foreach (var item in buckets) { if (Vector2.Distance (currentBrushe.transform.position, item.transform.position) < offset) { currentBucket = item; } } }
private IEnumerator _MoveSlug(Slug slug, Vec2i endPos, System.Action callback) { var trail = trailSys.CreateTrail(slug.pos, endPos, slug.color, turn); Vector2 startWPos = GameHelper.TileToWorldPos(slug.pos) + (Vector2)currLvl.transform.position; Vector2 endWPos = GameHelper.TileToWorldPos(endPos) + (Vector2)currLvl.transform.position; slug.transform.rotation = GameHelper.GetRotationFromVector(endWPos - startWPos); float duration = GameRules.AnimDurationPrTile * (Vector2.Distance(startWPos, endWPos) / Mathf.Sqrt(3f)); float endTime = Time.time + duration; bool checkedColChange = false; while (Time.time < endTime) { float t = 1 - (endTime - Time.time) / duration; slug.transform.position = startWPos + (endWPos - startWPos) * t; if (trail) { trail.SetVisible(1 - t); } if (trail != null && !checkedColChange && t > 0.5) { //Log("currLvl.Map.GetTOAtPos(endPos): " + currLvl.Map.GetTOAtPos(endPos)); PaintBucket bucket = null; foreach (var item in currLvl.Map.GetTOAtPos(endPos)) { //Log("item: " + item); if (item.GetType() == typeof(PaintBucket)) { bucket = (PaintBucket)item; break; } } //var bucket = currLvl.Map.GetTOAtPos(endPos).First(x => x is PaintBucket); if (bucket != null) { trail.SetSecondaryColor(((PaintBucketDefinition)bucket.ToDef).color); } checkedColChange = true; } yield return(null); } slug.SetPosition(endPos); if (trail) { trail.SetVisible(0); } callback(); }
// Update is called once per frame void Update () { if(brushes.Count == 0) { // Function It's over Debug.Log("END"); return; } FindClosetBucket (); if (currentBucket == null || currentBrushe == null) return; if (currentBucket.expectedColor == currentBrushe.color) { brushes.Remove (currentBrushe); currentBrushe.enabled = false; currentBrushe = null; currentBucket = null; } }
public VerticalHealthBar(PaintBucket bucket, Color fillColor) { this.bucket = bucket; this.fillColor = fillColor; }