public GuiDamageSplat() : base(ResourceManager.GetSprite("Icons/Splat")) { Image.Color = new Color(0.6f, 0.25f, 0.15f); Image.Rotation = Util.Roll(360); Scale = 0.4f; }
/** Adds a miss swipe to characters frame. */ private void addSwipe(MDRActor source) { var newSwipe = new GuiAttackSwipe(0.5f, 0.05f); newSwipe.X = 3 + Util.Roll(5); newSwipe.Y = 1 + Util.Roll(5); Add(newSwipe); }
/** * Creates the appropritate splat for given damage profile. * @frame The frame of the object we are going to add this splat to. */ public static GuiSplat CreateSplat(DamageInfo damage, Rect frame) { float extraTime = (0.1f * Mathf.Log(damage.Amount, 2)); GuiSplat result; bool isSpell = damage.DamageType.ID != 0; if (isSpell) { result = new GuiSpellSplat(damage.DamageType); } else { result = new GuiDamageSplat(); } result.Value = damage.Amount; result.ShowDelay = 0.05f; int varience = 5; result.X = varience - Util.Roll(varience * 2); result.Y = varience - Util.Roll(varience * 2); result.X += (int)frame.xMax - 5; result.Y += (int)frame.yMax - 5; if (isSpell) { result.Life = 1.25f; } else { result.Life = 0.5f + extraTime; } result.X -= (int)result.Frame.width / 2; result.Y -= (int)result.Frame.height / 2; return(result); }
public override void Update() { base.Update(); // check for deletes if (needsClean) { Clean(); } if (needsRenderTexture && !hasRenderTexture) { createRenderTexture(); } if (hasRenderTexture && !needsRenderTexture) { releaseRenderTexture(); } // force composited controls that aren't cached to render every frame. if (hasRenderTexture && !isCached) { Invalidate(); repaintRenderTexture(); } if (isCached) { var autoRepaintTimerExpired = false; if (AutoRefreshInterval != 0) { autoRepaintTimerExpired = (Time.time - lastRepaint > AutoRefreshInterval * (1000 + Util.Roll(100)) / 1000); } // a simple way to force updates when user interacts with object. // some variation so we don't re render all items on the same frame. if (IsMouseInside || autoRepaintTimerExpired) { Invalidate(); } } UpdateChildren(); }
public GuiAttackSwipe(float life = 2f, float showDelay = 0.0f) : base(swipeSprite, 0, life, showDelay) { Image.Rotation = Util.Roll(360); Scale = 0.4f; }