private void ProcessInput() { //Left if (Input.GetMouseButtonDown(0) || Input.GetButtonDown("Destruct")) { if (DialogueManager.Instance.IsInDialogue) { m_CurrentDialogue.NextDialogue(); } else if (m_CurrentInteractable != null) { if (m_CurrentInteractable.InteractableType == EInteractableType.Dialogue) { m_CurrentDialogue = m_CurrentInteractable.GetComponent <DialogueInteractable>(); if (m_CurrentDialogue == null) { Debug.LogError("No DialogueInteractable component found"); } else { m_CurrentDialogue.StartDialogue(EndDialogue); } } else { m_CurrentInteractType = EInteractType.Destruct; if (m_CurrentInteractable.InteractableType == EInteractableType.Destructable) { m_PlayerResources.AddResource(m_CurrentInteractable.ResourceType, m_CurrentInteractable.ResourceValue); m_CurrentInteractable.StartDestruct(); } if (PlayerDataModule.Inst.playerMovement.playerState == PlayerMovement.PlayerState.IdleLeft || PlayerDataModule.Inst.playerMovement.playerState == PlayerMovement.PlayerState.MovingLeft) { PlayerDataModule.Inst.playerMovement.playerState = PlayerMovement.PlayerState.DestructLeft; } if (PlayerDataModule.Inst.playerMovement.playerState == PlayerMovement.PlayerState.IdleRight || PlayerDataModule.Inst.playerMovement.playerState == PlayerMovement.PlayerState.MovingRight) { PlayerDataModule.Inst.playerMovement.playerState = PlayerMovement.PlayerState.DestructRight; } } } } //Right if (Input.GetMouseButtonDown(1) || Input.GetButtonDown("Repair")) { m_CurrentInteractType = EInteractType.Repair; if (m_CurrentInteractable != null && m_CurrentInteractable.InteractableType == EInteractableType.Repairable && m_PlayerResources.resources[(int)m_CurrentInteractable.ResourceType].Count > 0) { m_PlayerResources.UseResource(m_CurrentInteractable.ResourceType, m_CurrentInteractable.ResourceValue); m_CurrentInteractable.StartRepair(); } if (PlayerDataModule.Inst.playerMovement.playerState == PlayerMovement.PlayerState.IdleLeft || PlayerDataModule.Inst.playerMovement.playerState == PlayerMovement.PlayerState.MovingLeft) { PlayerDataModule.Inst.playerMovement.playerState = PlayerMovement.PlayerState.RepairLeft; } if (PlayerDataModule.Inst.playerMovement.playerState == PlayerMovement.PlayerState.IdleRight || PlayerDataModule.Inst.playerMovement.playerState == PlayerMovement.PlayerState.MovingRight) { PlayerDataModule.Inst.playerMovement.playerState = PlayerMovement.PlayerState.RepairRight; } } }
public void Interact(EInteractType interactType) { var ev = new InteractableEvent(this, currentInteractable, interactType); currentInteractable.onInteract.Invoke(ev); }
public InteractableEvent(InteractableSystem sender, InteractableSystem receiver, EInteractType interactType) { this.sender = sender; this.receiver = receiver; this.interactType = interactType; }