public void CreateTapEffect(Box box, float borderThickness) { TrackerBorderBox borderBox = new TrackerBorderBox(box, box.width, box.height, -borderThickness); Vector2 boxPos = effectContainer.OtherToLocal(box, new Vector2()); borderBox.x = boxPos.x; borderBox.y = boxPos.y; borderBox.rotation = box.rotation; borderBox.alpha = 0.35f; borderBox.scale = 1.0f; borderBox.shader = FShader.Additive; borderBox.color = box.player.color.color + new Color(0.3f, 0.3f, 0.3f); //add grey to make it brighter effectContainer.AddChild(borderBox); float growSize = 10.0f; float growScaleX = (borderBox.width + growSize) / borderBox.width; float growScaleY = (borderBox.height + growSize) / borderBox.height; Go.to(borderBox, 0.2f, new TweenConfig() .setEaseType(EaseType.Linear) .floatProp("scaleX", growScaleX) .floatProp("scaleY", growScaleY) .floatProp("alpha", 0.0f) .removeWhenComplete()); }
private void CreateBananaExplodeEffect(BBanana banana) { //we can't just get its x and y, because they might be transformed somehow Vector2 bananaPos = _effectHolder.OtherToLocal(banana, Vector2.zero); FSprite explodeSprite = new FSprite("Banana"); _effectHolder.AddChild(explodeSprite); explodeSprite.shader = FShader.Additive; explodeSprite.x = bananaPos.x; explodeSprite.y = bananaPos.y; explodeSprite.rotation = banana.rotation; // Go.to (explodeSprite, 0.3f, new TweenConfig().floatProp("scale",1.3f).floatProp("alpha",0.0f).onComplete(HandleExplodeSpriteComplete)); }