World.GameActors.GameObjects.Avatar.InteractWithAllInteractablesInFrontOf C# (CSharp) Method

InteractWithAllInteractablesInFrontOf() private method

private InteractWithAllInteractablesInFrontOf ( IAtlas atlas, ITilesetTable table ) : void
atlas IAtlas
table ITilesetTable
return void
        private void InteractWithAllInteractablesInFrontOf(IAtlas atlas, ITilesetTable table)
        {
            List<GameActorPosition> tilesInFrontOf = GetInteractableTilesInFrontOf(atlas);
            foreach (GameActorPosition tileInFrontOf in tilesInFrontOf)
            {
                if (tileInFrontOf != null)
                {
                    var interactable = tileInFrontOf.Actor as IInteractableGameActor;


                    if (interactable != null)
                    {
                        interactable.ApplyGameAction(atlas, new Interact(this), tileInFrontOf.Position, table);
                    }
                    if (tileInFrontOf.Actor is Fruit)
                    {
                        EatFruit(tileInFrontOf);
                    }
                }
            }
        }