public override void update(GameObject gameObject, SpriteRender spriteRender, GameTime gameTime, float depth) { string gameObjectStateString = GameObjectStateProvider.GetStateString(gameObject); TextureDefinition textureDefinition = TextureDefinitionFactory.Get(gameObjectStateString); // gameObject.state as first param Sprite sprite = gameObject.AnimationContainer.getCurrentSprite(TextureDefinitionFactory.Get(gameObjectStateString), gameTime); sprite.Depth = depth; spriteRender.Draw(sprite, gameObject.position, gameObject.Color); }
public override void update(GameObject gameObject, SpriteRender spriteRender, GameTime gameTime, float depth) { int originY = Sprite.TILE_TEXTURE_HEIGHT * 2 + 48; string gameObjectStateString = GameObjectStateProvider.GetStateString(gameObject); TextureDefinition textureDefinition = TextureDefinitionFactory.Get(gameObjectStateString); Sprite sprite = gameObject.AnimationContainer.getCurrentSprite(TextureDefinitionFactory.Get(gameObjectStateString), gameTime); sprite.Depth = depth; spriteRender.Draw(sprite, gameObject.position, new Vector2(0, originY)); }
public override void update(GameObject gameObject, SpriteRender spriteRender, GameTime gameTime, float depth) { string gameObjectStateString = GameObjectStateProvider.GetStateString(gameObject); TextureDefinition textureDefinition = TextureDefinitionFactory.Get(gameObjectStateString); // gameObject.state as first param Sprite sprite = gameObject.AnimationContainer.getCurrentSprite(TextureDefinitionFactory.Get(gameObjectStateString), gameTime); sprite.Depth = 0.6f; //based on arrow facing rotate the sprite sprite.Size = new Vector2(0.3f, 0.3f); spriteRender.Draw(sprite, gameObject.position); }
public override void update(GameObject gameObject, SpriteRender spriteRender, GameTime gameTime, float depth) { string gameObjectStateString = GameObjectStateProvider.GetStateString(gameObject); TextureDefinition textureDefinition = TextureDefinitionFactory.Get(gameObjectStateString); gameObject.Color = gameObject.Damaged ? Color.Red : Color.White; // gameObject.state as first param Sprite sprite = gameObject.AnimationContainer.getCurrentSprite(TextureDefinitionFactory.Get(gameObjectStateString), gameTime); sprite.Depth = depth; gameObject.Color = Color.White; if (gameObject.GameObjectStateContainer.GetPrevious() is StateWaving) { gameObject.Color = Color.Red; } spriteRender.Draw(sprite, gameObject.position, gameObject.Color); }