public CardHalo2D(IObject2DFactory factory, ALayer2D parentLayer, CardEntity2D parentCard) : base(parentLayer, factory, false) { Shader shader = new Shader(null, null, @"Assets\Graphics\Shaders\CardHalo.frag"); Texture distortionMap = factory.GetTextureById("distorsionTexture"); distortionMap.Repeated = true; distortionMap.Smooth = true; shader.SetUniform("currentTexture", new Shader.CurrentTextureType()); shader.SetUniform("distortionMapTexture", distortionMap); render = new RenderStates(BlendMode.Alpha); render.Shader = shader; this.isFocused = true; this.SpriteColor = Color.Yellow; this.ObjectSprite.Texture = factory.GetTextureById("starHaloTexture"); this.ObjectSprite.Origin = new SFML.System.Vector2f(this.ObjectSprite.TextureRect.Width / 2, this.ObjectSprite.TextureRect.Height / 2); // Active animation SequenceAnimation sequence = new SequenceAnimation(Time.FromSeconds(4), AnimationType.LOOP); IAnimation anim = new ZoomAnimation(ZOOM_AWAKENED, ZOOM_AWAKENED + .5f, Time.FromSeconds(2), AnimationType.ONETIME, InterpolationMethod.LINEAR); sequence.AddAnimation(0, anim); anim = new ZoomAnimation(ZOOM_AWAKENED + .5f, ZOOM_AWAKENED, Time.FromSeconds(2), AnimationType.ONETIME, InterpolationMethod.LINEAR); sequence.AddAnimation(2, anim); this.animationsList.Add(sequence); this.Initialize(parentCard); }
private void Initialize(CardEntity2D entity) { this.HaloState = CardHaloState.NOT_ACTIVE; this.Position = entity.Position; this.IsFocused = false; }