예제 #1
0
        private void UpdateCardInteraction()
        {
            if (this.CardPicked != null)
            {
                Vector2i mousePosition = this.MousePosition;

                Vector2f cardPosition = new Vector2f(mousePosition.X, mousePosition.Y);

                CardEntity cardEntity = this.object2DToObjects[this.CardPicked] as CardEntity;

                if (this.focusedGraphicEntity2D is StarEntity2D)
                {
                    StarEntity2D starEntity2D = this.focusedGraphicEntity2D as StarEntity2D;

                    StarEntity starEntity = this.object2DToObjects[starEntity2D] as StarEntity;

                    if (starEntity.CanSocketCard(cardEntity))
                    {
                        cardPosition = new Vector2f(starEntity2D.Position.X, starEntity2D.Position.Y);
                    }
                }

                this.CardPicked.Position = cardPosition;
            }
        }
예제 #2
0
        private void UpdateNotActive(Time deltaTime)
        {
            StarEntity2D starNotActive = this.domainStars.FirstOrDefault(pElem => pElem.StarEntityState != StarEntity2D.StarState.ACTIVE);

            if (starNotActive == null)
            {
                this.StartActiveState();
            }
        }
예제 #3
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);
        }
예제 #4
0
        protected override void OnEntityPropertyChanged(AEntity obj, string propertyName)
        {
            base.OnEntityPropertyChanged(obj, propertyName);

            switch (propertyName)
            {
            case "CardSocketed":
                StarEntity   starEntity   = obj as StarEntity;
                StarEntity2D starEntity2D = this.objectToObject2Ds[obj] as StarEntity2D;

                starEntity2D.SetCardSocketed(starEntity.CardSocketed);
                break;

            case "IsSocketed":
                (this.objectToObject2Ds[obj] as CardEntity2D).IsSocketed = ((obj as CardEntity).ParentStar != null);
                break;

            case "IsFliped":
                (this.objectToObject2Ds[obj] as CardEntity2D).IsFliped = (obj as CardEntity).IsFliped;
                break;

            case "IsSelected":
                (this.objectToObject2Ds[obj] as CardEntity2D).IsSelected = (obj as CardEntity).IsSelected;
                break;

            case "IsAwakened":
                CardEntity2D cardAwakened = this.objectToObject2Ds[obj] as CardEntity2D;
                cardAwakened.IsAwakened = (obj as CardEntity).Card.IsAwakened;

                cardAwakened.Priority = 2000 + this.maxAwakenedPriority++;
                break;

            case "IsActive":
                this.objectToObject2Ds[obj].IsActive = (obj as AEntity).IsActive;
                break;

            case "CurrentOwner":
                CardEntity cardConcerned = obj as CardEntity;

                (this.objectToObject2Ds[cardConcerned] as CardEntity2D).PlayerColor = cardConcerned.Card.CurrentOwner.PlayerColor;
                (this.objectToObject2Ds[cardConcerned.ParentStar] as StarEntity2D).SetCardSocketed(cardConcerned);
                break;

            case "Value":
                CardEntity2D card2DChanged = this.objectToObject2Ds[obj] as CardEntity2D;
                CardEntity   cardChanged   = obj as CardEntity;
                card2DChanged.CardValue         = cardChanged.Card.Value;
                card2DChanged.CardValueModifier = cardChanged.Card.ValueModifier;
                break;

            case "DomainOwner":
                CJStarDomain2D domain2DChanged = this.objectToObject2Ds[obj] as CJStarDomain2D;
                CJStarDomain   domainChanged   = (obj as CJStarDomain);

                if (domainChanged.DomainOwner != null)
                {
                    domain2DChanged.TargetedColor = domainChanged.DomainOwner.PlayerColor;
                }
                else
                {
                    domain2DChanged.TargetedColor = Color.Black;
                }
                break;
            }
        }