public void Initialize(IWorldData worldData)
 {
     sprite   = worldData.GetWorldObject(worldObjectId).GetComponent <Sprite>();
     movement = worldData.GetWorldObject(worldObjectId).GetComponent <Movement>();
     path     = pathfinding.FindPath(sprite.TilePosition, goalTilePosition, worldData.GetComponents <ICollisionComponent>());
     index    = 0;
     IsDone   = false;
 }
        public void Initialize(IWorldData worldData)
        {
            IsDone = false;
            var entity = worldData.GetWorldObject(entityId);

            if (entity == null)
            {
                IsDone = true;
            }
            else
            {
                var sprite = entity.GetComponent <Sprite>();
                emotion.PlayEmotion((int)sprite.TilePosition.X, (int)sprite.TilePosition.Y - 1);
            }
        }
        protected override bool ShouldTriggerEvents()
        {
            var sprite                 = Owner.GetComponent <Sprite>();
            var playerSprite           = worldData.GetWorldObject("player").GetComponent <Sprite>();
            var currentDirection       = (Directions)(sprite.DrawFrame.Y / sprite.DrawFrame.Height);
            var currentDirectionVector = UtilityService.ConvertDirectionToVector(currentDirection);

            for (int n = 0; n < Range; n++)
            {
                var position = sprite.TilePosition + currentDirectionVector * (n + 1);
                if (playerSprite.TilePosition == position)
                {
                    return(true);
                }
                var collision = Owner.GetComponent <Collision>();
                if (collision.CheckCollision((int)position.X, (int)position.Y))
                {
                    return(false);
                }
            }
            return(false);
        }