Exemple #1
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;
        }
        //protected override AEntity2D AddEntity(AEntity obj)
        //{
        //    AEntity2D entity2D = base.AddEntity(obj);

        //    return entity2D;
        //}

        protected override void OnEntityPropertyChanged(AEntity obj, string propertyName)
        {
            base.OnEntityPropertyChanged(obj, propertyName);

            switch (propertyName)
            {
            case "Value":
                CardEntityAwakenedDecorator2D cardConcerned2D = this.objectToObject2Ds[obj] as CardEntityAwakenedDecorator2D;
                CardEntityAwakenedDecorator   cardConcerned   = (obj as CardEntityAwakenedDecorator);

                cardConcerned2D.CardValue         = cardConcerned.Card.Value;
                cardConcerned2D.CardValueModifier = cardConcerned.Card.ValueModifier;
                break;
            }
        }
        public override void InitializeLayer(IObject2DFactory factory)
        {
            this.cardsHand.Clear();

            base.InitializeLayer(factory);

            this.cardFocused  = null;
            this.cardAwakened = null;

            this.pendingRemovingCardEntities.Clear();

            this.LevelTurnPhase = TurnPhase.VOID;

            this.IsRunningBehavior = false;
        }