public void OnSelect(Interactable.Interaction interaction) { if (interaction.player.Item == ItemsEnum.Nothing) { interaction.player.Item = ItemsEnum.Broom; Destroy(gameObject); } }
public void OnInteract(Interactable.Interaction interaction) { if (!isDisposing) { switch (interaction.player.Item) { case ItemsEnum.Vacuum: case ItemsEnum.Broom: isDisposing = true; interaction.player.CleaningTime = 2f; interaction.player.HandlingDisposable = this; interaction.player.StateMachine.SetState(Player.State.Cleaning); break; } } }
bool HandleDialog(ref bool consumeInput) { if (consumeInput) { return(false); } if (!hasInteraction) { if (this.currentState != PlayerStates.Grounded) { return(false); } if (interactables.Count == 0) { return(false); } var interactionIndex = interactables[0].GetInteraction(manager.flags); consumeInput = interactionIndex != -1; if (consumeInput) { InteractButtonText = "Interact"; } if (Input.GetButtonDown("Interact")) { if (interactionIndex != -1) { interaction = interactables[0].interactions[interactionIndex]; hasInteraction = interaction.dialog.Length > 0; if (hasInteraction) { dialogIndex = 0; ShowDialog(); this.currentState = PlayerStates.Dialog; return(true); } } } return(false); } else { consumeInput = true; InteractButtonText = "Continue"; if (Input.GetButtonDown("Interact")) { dialogIndex++; if (dialogIndex < interaction.dialog.Length) { ShowDialog(); } else { HideDialog(); hasInteraction = false; manager.ChangeFlags(interaction.flagsSet, interaction.flagsRemove); this.currentState = this.movement.Grounded() ? PlayerStates.Grounded : PlayerStates.Aerial; } } return(true); } }