public void OnInteract(InputAction.CallbackContext context) { if (context.phase == InputActionPhase.Performed) { InteractEvent.Invoke(); } }
public void OnInteract(InputAction.CallbackContext context) { if ((context.phase == InputActionPhase.Performed) && (_gameStateManager.CurrentGameState == GameState.Gameplay)) // Interaction is only possible when in gameplay GameState { InteractEvent.Invoke(); } }
public override void Interact() { base.Interact(); talk(); if (InteractEvent != null) { InteractEvent.Invoke(this); } }
private void Grab(GameObject p_toGrab) { InteractEvent.Invoke(); m_grabbedObject = p_toGrab; m_grabbedObjectScript = m_grabbedObject.GetComponent <Grabbable>(); m_grabbedObjectScript.Grab(gameObject); m_distanceBetweenObjectAndCameraDueToMeshSize = m_grabbedObjectScript.CalculateDistanceToCameraOffset(); m_grabbedDuringThisFrame = true; }
public virtual bool Interact(Interacter source) { if (IsInteractable(source)) { OnInteract.Invoke(source, this); return(true); } return(false); }
private void ThrowObject(float p_strength) { InteractEvent.Invoke(); m_grabbedObjectScript.Drop(gameObject); m_grabbedObjectScript.Throw(p_strength); m_grabbedObject = null; m_grabbedObjectScript = null; }
public virtual bool InteractWith(Pawn source) { if (IgnoresInteraction) { return(false); } OnInteract.Invoke(source); return(true); }
private void UseButton() { PlayOneSoundRandom(); onInteract.Invoke(parent); if (numberUses > 0) { numberUses--; if (numberUses <= 0) { Destroy(this); } } }
void Update() { if (Input.GetKeyDown(KeyCode.E)) { if (Physics.Raycast(Camera.main.transform.position, Camera.main.transform.forward, out _hit, InteractDistance)) { if (_hit.collider.gameObject != null) { InteractEvent.Invoke(_hit.collider.gameObject); } } } }
public override void Interact() { if (Active) { if (CurrentPage >= Pages.Count - 1) { Hide(); InteractEvent?.Invoke(this, null); } else { CurrentPage++; Stopwatch.Restart(); } } }
IEnumerator OperateSwitch(bool opened) { while (working) { yield return(null); } working = true; anim.SetBool("Opened", opened); if (opened) { OnSwitchOn.Invoke(this); } else { OnSwitchOff.Invoke(this); } yield return(new WaitForSeconds(1)); working = false; }
void Update() { if (target != null && agent.hasPath && agent.remainingDistance <= interactDistance) { Event?.Invoke(gameObject, target); target = null; } if (EventSystem.current.IsPointerOverGameObject() || !Input.GetMouseButton(0)) { return; } Ray ray = cam.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 100)) { var interaction = hit.transform.gameObject.GetComponent <Interactable>(); target = (interaction == null) ? null : hit.transform.gameObject; agent.SetDestination(hit.point); } }
public override void Interact() { InteractEvent?.Invoke(this, null); }
public void InvokeGameFlowProgression(int gameStateId) { gameFlowEvent.Invoke(gameStateId); }
public void Interact(GameObject caller) { OnInteracted?.Invoke(caller); }
public void InvokeInteract(int itemId) { interactEvent.Invoke(itemId); }
private void OnInteract() { //Debug.Log("OnInteract"); InteractEvent?.Invoke(); }
public void AddInteractionController() { var controller = new SmartController(); var buttonsCreated = StaticServiceLocator.ContainsService <List <IButtonAble> >(); if (!buttonsCreated) { var interactButton = new List <IButtonAble> { new KeyButton(Keys.E), new GamePadButton(Buttons.A) }; StaticServiceLocator.AddService(interactButton); } var buttons = StaticServiceLocator.GetService <List <IButtonAble> >(); var smartButton = new CompositeSmartButton(buttons) { OnButtonJustPressed = (sender, args) => { if (!DialogBox.Interact()) { InteractEvent?.Invoke(this, null); } } }; controller.AddButton(smartButton); var upButton = new List <IButtonAble> { new DirectionGamePadButton(Buttons.DPadUp, PlayerIndex.One, false) }; var smartUpButton = new CompositeSmartButton(upButton) { OnButtonJustPressed = (sender, args) => { DialogBox.Up(); } }; controller.AddButton(smartUpButton); var downButton = new List <IButtonAble> { new DirectionGamePadButton(Buttons.DPadDown, PlayerIndex.One, false) }; var smartDownButton = new CompositeSmartButton(downButton) { OnButtonJustPressed = (sender, args) => { DialogBox.Down(); } }; controller.AddButton(smartDownButton); var optionsButtons = new List <IButtonAble> { new KeyButton(Keys.Escape), new GamePadButton(Buttons.Start) }; var optionsAction = new CompositeSmartButton(optionsButtons) { OnButtonJustPressed = (sender, args) => { _backButtonClickEvent.Invoke(this, null); } }; controller.AddButton(optionsAction); UpdateList.Add(controller); }
public void invokeEvent(InteractEventArgs interactEventArgs) { InteractEvent?.Invoke(this, interactEventArgs); }