public bool Interact(PositionalHandApply interaction) { //translate to the tile interaction system //pass the interaction down to the basic tile LayerTile tile = LayerTileAt(interaction.WorldPositionTarget); if (tile is BasicTile basicTile) { var tileApply = new TileApply(interaction.Performer, interaction.UsedObject, interaction.Intent, (Vector2Int)WorldToCell(interaction.WorldPositionTarget), this, basicTile, interaction.HandSlot, interaction.TargetVector); var i = 0; foreach (var tileInteraction in basicTile.TileInteractions) { if (tileInteraction == null) { continue; } if (tileInteraction.WillInteract(tileApply, NetworkSide.Client) && Cooldowns.TryStartClient(interaction, CommonCooldowns.Instance.Interaction)) { //request the tile interaction with this index RequestInteractMessage.SendTileApply(tileApply, this, tileInteraction, i); return(true); } i++; } } return(false); }
private bool TryInteractWithTile(TileApply interaction) { // Iterate over the interactions for the given tile until a valid one is found. foreach (var tileInteraction in interaction.BasicTile.TileInteractions) { if (tileInteraction == null) { continue; } if (tileInteraction.WillInteract(interaction, NetworkSide.Client) && Cooldowns.TryStartClient(interaction, CommonCooldowns.Instance.Interaction)) { //request the tile interaction with this index RequestInteractMessage.SendTileApply(interaction, this, tileInteraction); return(true); } } return(false); }