예제 #1
0
        public StarEntity2D(IObject2DFactory factory, ALayer2D parentLayer, StarEntity entity) :
            base(parentLayer, factory, entity)
        {
            Shader shader = new Shader(null, null, @"Assets\Graphics\Shaders\StarFrag.frag");

            Texture distortionMap = factory.GetTextureById("distortionTexture");

            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.IsFocused = false;

            this.SetCardSocketed(entity.CardSocketed);

            this.ObjectSprite.Texture = factory.GetTextureById("starTexture");

            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(1, 1.5f, Time.FromSeconds(2), AnimationType.ONETIME, InterpolationMethod.LINEAR);

            sequence.AddAnimation(0, anim);

            anim = new ZoomAnimation(1.5f, 1, Time.FromSeconds(2), AnimationType.ONETIME, InterpolationMethod.LINEAR);
            sequence.AddAnimation(2, anim);

            this.animationsList.Add(sequence);

            // Start : Transitioning active animation
            Random rand      = new Random();
            float  startTime = (float)(rand.NextDouble() * 2);

            sequence = new SequenceAnimation(Time.FromSeconds(startTime + 2), AnimationType.ONETIME);

            anim = new ZoomAnimation(0, 0, Time.FromSeconds(startTime), AnimationType.ONETIME, InterpolationMethod.STEP);
            sequence.AddAnimation(0, anim);

            anim = new ZoomAnimation(0f, 1f, Time.FromSeconds(2), AnimationType.ONETIME, InterpolationMethod.LINEAR);
            sequence.AddAnimation(startTime, anim);

            this.animationsList.Add(sequence);

            this.InitializeState(entity);
        }
예제 #2
0
        public T_TeleEntity2D(IObject2DFactory factory, ALayer2D layer2D, T_TeleEntity entity) :
            base(layer2D, factory, entity)
        {
            this.Position = entity.Position;
            this.Rotation = entity.Rotation;

            this.ObjectSprite.Texture = factory.GetTextureById("TVTexture");

            this.ObjectSprite.TextureRect = new SFML.Graphics.IntRect(0, 0, 86, 76);

            this.ObjectSprite.Origin = new SFML.System.Vector2f(this.ObjectSprite.TextureRect.Width / 2, this.ObjectSprite.TextureRect.Height / 2);

            SequenceAnimation sequence = new SequenceAnimation(Time.FromSeconds(20), AnimationType.LOOP);

            IAnimation anim = new ZoomAnimation(1, 2, Time.FromSeconds(10), AnimationType.ONETIME, InterpolationMethod.LINEAR);

            sequence.AddAnimation(0, anim);

            anim = new ZoomAnimation(2, 1, Time.FromSeconds(10), AnimationType.ONETIME, InterpolationMethod.LINEAR);
            sequence.AddAnimation(10, anim);

            anim = new FrameAnimation(new SFML.Graphics.IntRect[] { new SFML.Graphics.IntRect(0, 0, 86, 76), new SFML.Graphics.IntRect(86, 0, 86, 76) }, Time.FromSeconds(2), AnimationType.LOOP, InterpolationMethod.LINEAR);
            sequence.AddAnimation(10.01f, anim);

            this.animationsList.Add(sequence);

            this.PlayAnimation(0);
        }
예제 #3
0
        public StarEffect2D(IObject2DFactory factory, ALayer2D parentLayer, CardEntityAwakenedDecorator2D parentCardDecorator2D) :
            base(parentLayer, factory, false)
        {
            this.Position = parentCardDecorator2D.Position;

            this.ObjectSprite.Texture = factory.GetTextureById("starEffectTexture");

            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.ONETIME);

            IAnimation anim = new ZoomAnimation(0.1f, 1, Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.SQUARE_ACC);

            sequence.AddAnimation(0, anim);

            //anim = new ZoomAnimation(1, 0.1f, Time.FromSeconds(1), AnimationType.ONETIME, InterpolationMethod.SQUARE_ACC);
            //sequence.AddAnimation(5, anim);

            anim = new RotationAnimation(0, 360, Time.FromSeconds(6), AnimationType.ONETIME, InterpolationMethod.LINEAR);
            sequence.AddAnimation(0.01f, anim);

            this.animationsList.Add(sequence);

            this.IsActive = false;
        }
예제 #4
0
        public CJStarDomain2D(ALayer2D layer2D, IObject2DFactory factory, CJStarDomain entity) :
            base(layer2D, factory, entity)
        {
            // TO REMOVE
            //this.Test();

            //this.widthRatio = 0;
            //this.heightRatio = 0;

            this.targetedColor = Color.Black;

            Shader shader = new Shader(null, null, @"Assets\Graphics\Shaders\StarDomain.frag");

            Texture distortionMap = factory.GetTextureById("distorsionTexture");

            this.ObjectSprite.Texture          = factory.GetTextureById("distorsionTexture");
            this.ObjectSprite.Texture.Repeated = true;

            distortionMap.Repeated = true;
            distortionMap.Smooth   = true;
            shader.SetUniform("currentTexture", new Shader.CurrentTextureType());

            render        = new RenderStates(BlendMode.Alpha);
            render.Shader = shader;

            this.isFocused = true;
            this.IsFocused = false;

            this.Priority = entity.Priority;

            this.domainStars = entity.Domain.Select(pElem => layer2D.GetEntity2DFromEntity(pElem) as StarEntity2D).ToList();
            this.isFilled    = entity.IsFilled;
            shader.SetUniform("isFilled", this.isFilled);

            SequenceAnimation sequence = new SequenceAnimation(Time.FromSeconds(6), AnimationType.ONETIME);
            IAnimation        anim     = new ZoomAnimation(1f, 2f, Time.FromSeconds(2), AnimationType.ONETIME, InterpolationMethod.SQUARE_ACC);

            sequence.AddAnimation(0, anim);

            anim = new ZoomAnimation(2f, 1f, Time.FromSeconds(3), AnimationType.ONETIME, InterpolationMethod.SQUARE_ACC);
            sequence.AddAnimation(2, anim);
            this.animationsList.Add(sequence);

            this.UpdateScaling(entity);

            this.StartNotActiveState();
        }
        public CurvedStarLinkEntity2D(ALayer2D layer2D, IObject2DFactory factory, CurvedStarLinkEntity entity) :
            base(layer2D, entity)
        {
            this.starEntityFrom = layer2D.GetEntity2DFromEntity(entity.StarFrom) as StarEntity2D;
            this.starEntityTo   = layer2D.GetEntity2DFromEntity(entity.StarTo) as StarEntity2D;

            this.ObjectSprite.Color = Color.Blue;

            //this.ObjectSprite.Texture = factory.GetTextureByIndex(0);


            this.radius = (int)entity.Radius;
            this.center = new Vector2f(entity.Center.X, entity.Center.Y);

            Shader shader = new Shader(null, null, @"Assets\Graphics\Shaders\LinkCurvedFrag.frag");

            Texture distortionMap = factory.GetTextureById("distorsionTexture");

            this.ObjectSprite.Texture          = factory.GetTextureById("distorsionTexture");
            this.ObjectSprite.Texture.Repeated = true;

            distortionMap.Repeated = true;
            distortionMap.Smooth   = true;
            shader.SetUniform("currentTexture", new Shader.CurrentTextureType());
            shader.SetUniform("distTexture", distortionMap);

            render        = new RenderStates(BlendMode.Alpha);
            render.Shader = shader;

            shader.SetUniform("radius", (float)(this.radius));
            shader.SetUniform("margin", (float)(StarLinkEntity2D.WIDTH_LINK / 2));
            shader.SetUniform("sideMainTexture", (int)this.ObjectSprite.Texture.Size.X);
            this.UpdateScaling();

            this.Priority = 9;

            this.InitializeState(entity);
        }
예제 #6
0
        public override void InitializeLayer(IObject2DFactory factory)
        {
            base.InitializeLayer(factory);

            this.Position = this.parentLayer.Position;

            this.Rotation = this.parentLayer.Rotation;

            foreach (string texturePath in factory.TexturesPath)
            {
                string idTexture = Path.GetFileNameWithoutExtension(texturePath);
                this.nameToTiles.Add(idTexture, new TileBackgoundObject2D(this, factory.GetTextureById(idTexture), idTexture));
            }
        }
예제 #7
0
        public StarLinkEntity2D(ALayer2D layer2D, IObject2DFactory factory, StarLinkEntity entity) :
            base(layer2D, factory, entity)
        {
            this.currentColorFrom = Color.Black;
            this.currentColorTo   = Color.Black;
            this.ratioColorFrom   = -1;
            this.ratioLinkTo      = -1;

            this.starEntityFrom = layer2D.GetEntity2DFromEntity(entity.StarFrom) as StarEntity2D;
            this.starEntityTo   = layer2D.GetEntity2DFromEntity(entity.StarTo) as StarEntity2D;

            //this.fillRatio = 0;
            this.isFocused = true;

            this.ObjectSprite.Color = Color.Blue;

            Shader shader = new Shader(null, null, @"Assets\Graphics\Shaders\LinkSimpleFrag.frag");

            Texture distortionMap = factory.GetTextureById("distorsionTexture");

            this.ObjectSprite.Texture          = factory.GetTextureById("distorsionTexture");
            this.ObjectSprite.Texture.Repeated = true;

            distortionMap.Repeated = true;
            distortionMap.Smooth   = true;
            shader.SetUniform("currentTexture", new Shader.CurrentTextureType());
            shader.SetUniform("distTexture", distortionMap);

            render        = new RenderStates(BlendMode.Alpha);
            render.Shader = shader;

            this.UpdateScaling();

            this.Priority = 9;

            this.InitializeState(entity);
        }
예제 #8
0
        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);
        }
예제 #9
0
        public CardEntity2D(IObject2DFactory factory, ALayer2D layer2D, CardEntity entity) :
            base(layer2D, factory, true)
        {
            this.cardHalo  = new CardHalo2D(factory, layer2D, this);
            this.cardLabel = new CardLabel2D(layer2D, entity.CardValue);

            this.ObjectSprite.Texture = factory.GetTextureById("backCardTexture");

            this.ObjectSprite.Origin = new Vector2f(this.ObjectSprite.TextureRect.Width / 2, this.ObjectSprite.TextureRect.Height / 2);

            this.canevasSprite = new Sprite();

            this.canevasSprite.TextureRect = new IntRect(0, 0, this.ObjectSprite.TextureRect.Width + 2 * WIDTH_BORDER, this.ObjectSprite.TextureRect.Height + 2 * WIDTH_BORDER);

            this.canevasSprite.Origin = new Vector2f(this.canevasSprite.TextureRect.Width / 2, this.canevasSprite.TextureRect.Height / 2);

            this.Position = entity.Position;
            this.Rotation = entity.Rotation;

            this.canevasSprite.Color = Color.Black;
            this.playerColor         = Color.Black;
            this.isSocketed          = entity.ParentStar == null;
            this.ratioColor          = -1;
            this.isFocused           = true;
            this.isSelected          = !entity.IsSelected;

            Shader shader = new Shader(null, null, @"Assets\Graphics\Shaders\CardCanevas.frag");

            Texture distortionMap = factory.GetTextureById("distorsionTexture");

            distortionMap.Repeated     = true;
            distortionMap.Smooth       = true;
            this.canevasSprite.Texture = distortionMap;
            shader.SetUniform("distortionMapTexture", distortionMap);

            render        = new RenderStates(BlendMode.Alpha);
            render.Shader = shader;

            //SequenceAnimation flipAnimation = new SequenceAnimation(Time.FromSeconds(1), AnimationType.ONETIME);
            IAnimation animation = new FlipAnimation(0, (float)(Math.PI / 2), Time.FromSeconds(TIME_FLIP), AnimationType.ONETIME, InterpolationMethod.LINEAR, 1);

            //flipAnimation.AddAnimation(0, animation);
            this.animationsList.Add(animation);

            animation = new FlipAnimation((float)(Math.PI / 2), 0, Time.FromSeconds(TIME_FLIP), AnimationType.ONETIME, InterpolationMethod.LINEAR, 1);
            //flipAnimation.AddAnimation(0.5f, animation);
            this.animationsList.Add(animation);

            SequenceAnimation sequenceAnimation = new SequenceAnimation(Time.FromSeconds(1f), AnimationType.LOOP);

            animation = new ZoomAnimation(0.9f, 1.1f, Time.FromSeconds(0.5f), AnimationType.ONETIME, InterpolationMethod.LINEAR);
            sequenceAnimation.AddAnimation(0, animation);

            animation = new ZoomAnimation(1.1f, 0.9f, Time.FromSeconds(0.5f), AnimationType.ONETIME, InterpolationMethod.LINEAR);
            sequenceAnimation.AddAnimation(0.5f, animation);
            this.animationsList.Add(sequenceAnimation);

            this.Initialize(entity);

            this.UpdateScaling();
            render.Shader.SetUniform("margin", (WIDTH_BORDER - 5f) / this.canevasSprite.Texture.Size.X);
            render.Shader.SetUniform("outMargin", 2f / this.canevasSprite.Texture.Size.X);
            render.Shader.SetUniform("radius", RADIUS_BORDER / this.canevasSprite.Texture.Size.X);
        }