public ParticleEffect(Vector2 position, Color tint, int particleCount, TextureData textureData, float particleSpeed, float particleGravity, float maxScale, float lifeTime, bool rotate)
     : base(position)
 {
     this.textureData = textureData;
     this.tint = tint;
     particles = new Particle[particleCount];
     for (int i = 0; i < particleCount; ++i)
         particles[i] = new Particle(position, particleSpeed, particleGravity, maxScale, lifeTime, rotate);
 }
 public ItemWithAttributes(Attributes attributes)
 {
     Attributes = attributes;
     statusParticleTextureData = getTextureDataForStatus(Attributes.Status);
     statusParticleTimer = 0.0f;
     affiliationTint = getColorForAffiliation(Attributes.Affiliation);
     affiliationTintAlpha = 0.0f;
     incAffiliationTintAlpha = true;
 }
 public FloatingParticle(Vector2 position, Vector2 velocity, Vector2 scale, float alphaTime, TextureData textureData)
     : base(position)
 {
     Velocity = velocity;
     Scale = scale;
     this.textureData = textureData;
     alphaSpeed = 1.0f / alphaTime;
     alpha = 1.0f;
     ZIndex = -1;
 }
        public Battle(Party playerParty, Party enemyParty, Encounter overworldEncounter)
        {
            if (playerParty == null)
                throw new Exception("Party playerParty cannot be null");
            if (enemyParty == null)
                throw new Exception("Party enemyParty cannot be null");

            PlayerParty = playerParty.Tap(party => party.StartBattle(this));
            EnemyParty = enemyParty.Tap(party => party.StartBattle(this));

            states = new Stack<BattleState>();
            states.Push(new BattleStates.Intro(this));
            stateChanged = true;

            OverworldEncounter = overworldEncounter;

            Camera = new Camera(Game1.ScreenSize);
            Camera.Position = Camera.Size / 2.0f;
            cameraUpdateDelay = 0.0f;

            RepositionPartyMembers();
            updateCamera();
            Camera.Scale = Camera.TargetScale;
            updateCamera();
            Camera.Position = Camera.TargetPosition;

            generateBackground();
            generateBackgroundScenery();
            generateFloorScenery();

            whitePixelTextureData = ResourceManager.GetTextureData("white_pixel");
            arrowTextureData = ResourceManager.GetTextureData("arrow_down");
            CharacterClassHeadTextureData = new Dictionary<CharacterClass, TextureData> {
                { CharacterClass.Warrior, ResourceManager.GetTextureData("battle_ui/warrior_head") },
                { CharacterClass.Marksman, ResourceManager.GetTextureData("battle_ui/marksman_head") },
                { CharacterClass.Medic, ResourceManager.GetTextureData("battle_ui/medic_head") },
                { CharacterClass.Thief, ResourceManager.GetTextureData("battle_ui/thief_head") }
            };
            keyboardButtonTextureData = ResourceManager.GetTextureData("battle_ui/buttons/key");
            gamepadButtonTextureData = new Dictionary<InputButton, TextureData> {
                { InputButton.A, ResourceManager.GetTextureData("battle_ui/buttons/gamepad_a") },
                { InputButton.B, ResourceManager.GetTextureData("battle_ui/buttons/gamepad_b") },
                { InputButton.LeftTrigger, ResourceManager.GetTextureData("battle_ui/buttons/gamepad_lt") }
            };

            BorderTextureData = new TextureData[Directions.Length];
            for (int i = 0; i < Directions.Length; ++i)
                BorderTextureData[i] = ResourceManager.GetTextureData("battle_ui/borders/" + Directions[i]);

            PlayerPartyItemsUsed = 0;
            LastUsedThinkActionTypes = new ConditionalWeakTable<PartyMember, Wrapper<BattleStates.ThinkActionType>>();
        }
        public PauseMenu()
        {
            pixelTextureData = ResourceManager.GetTextureData("white_pixel");
            options = new List<string> {
                "Resume",
                "Exit"
            };
            currentOptionIndex = 0;

            inputButtonListener = new InputButtonListener(new Dictionary<InputButton, ButtonEventHandlers> {
                { InputButton.Down, new ButtonEventHandlers(down: nextOption) },
                { InputButton.Up, new ButtonEventHandlers(down: previousOption) },
                { InputButton.A, new ButtonEventHandlers(up: selectOption) }
            });
        }
 public Entity(Vector2 position)
 {
     ResetManipulation();
     Position = position;
     ZIndex = 0;
     DepthOverride = -1.0f;
     Altitude = 0.0f;
     Alive = true;
     Visible = true;
     UpdateExtensions = new List<UpdateExtension>();
     Shader = null;
     PauseAnimation = false;
     RenderShadow = false;
     shadowTextureData = ResourceManager.GetTextureData("shadow");
 }
        private void addSkeletonAttachment(string slotName, string attachmentName, TextureData textureData)
        {
            RegionAttachment regionAttachment = new RegionAttachment(attachmentName);

            regionAttachment.RendererObject = textureData.Texture;
            regionAttachment.Width = regionAttachment.RegionWidth = regionAttachment.RegionOriginalWidth = textureData.Texture.Width;
            regionAttachment.Height = regionAttachment.RegionHeight = regionAttachment.RegionOriginalHeight = textureData.Texture.Height;
            regionAttachment.RegionOffsetX = textureData.OriginX;
            regionAttachment.RegionOffsetY = textureData.OriginY;
            regionAttachment.Rotation = textureData.Rotation;
            regionAttachment.SetUVs(0, 0, 1, 1, false);
            regionAttachment.UpdateOffset();

            Skeleton.Data.FindSkin("default").AddAttachment(Skeleton.FindSlotIndex(slotName), attachmentName, regionAttachment);
        }
        public void SetSkeletonAttachment(string slotName, string attachmentName, TextureData textureData = null, bool forceNoTextureData = false)
        {
            if (Skeleton == null || Skeleton.FindSlot(slotName) == null)
                return;

            if (Skeleton.GetAttachment(slotName, attachmentName) == null)
            {
                if (textureData != null)
                {
                    addSkeletonAttachment(slotName, attachmentName, textureData);
                    Skeleton.SetAttachment(slotName, attachmentName);
                }
                else if (forceNoTextureData)
                {
                    Skeleton.Data.FindSkin("default").AddAttachment(Skeleton.FindSlotIndex(slotName), attachmentName, new RegionAttachment(attachmentName));
                    Skeleton.SetAttachment(slotName, attachmentName);
                }
            }
            else
                Skeleton.SetAttachment(slotName, attachmentName);
        }
 public void Draw(TextureData textureData, Vector2 position, Color color)
 {
     Draw(textureData, position, color, 0.0f, new Vector2(1.0f));
 }
示例#10
0
 public FloatingParticle(Vector2 position, Vector2 velocity, Vector2 scale, float alphaTime, TextureData textureData)
     : base(position)
 {
     Velocity         = velocity;
     Scale            = scale;
     this.textureData = textureData;
     alphaSpeed       = 1.0f / alphaTime;
     alpha            = 1.0f;
     ZIndex           = -1;
 }
 public void Draw(Color tint, Renderer renderer, TextureData textureData)
 {
     float alpha = 1.0f - (time / lifeTime);
     renderer.Draw(textureData, position, new Color(tint.R, tint.G, tint.B, (byte)(255 * alpha)), rotation, new Vector2(scale));
 }
 public void Draw(TextureData textureData, Vector2 position, Color color, float rotation, Vector2 scale, bool cameraTransform = true)
 {
     beginSpriteBatch();
     if (cameraTransform)
     {
         translatePosition(ref position);
         updateScale(ref scale);
     }
     updateColor(ref color);
     Rectangle sourceRect = new Rectangle(0, 0, textureData.Texture.Width, textureData.Texture.Height);
     SpriteEffects spriteEffects = getSpriteEffectsFromScale(ref scale);
     spriteBatch.Draw(textureData.Texture, position, sourceRect, color, rotation, textureData.Origin, scale * textureData.Scale, spriteEffects, 0.0f);
 }
 public void Draw(TextureData textureData, Vector2 position, Color color)
 {
     Draw(textureData, position, color, 0.0f, new Vector2(1.0f));
 }
 public GameOver()
 {
     whitePixelTextureData = ResourceManager.GetTextureData("white_pixel");
     gameOverAlphaTimer = 0.0f;
 }