public void Interact(ICanInteract interactor, InteractionType interactionType) { if (!m_Tower.GetIsActivated()) { return; } if (!(interactor is Player)) { return; } Player player = interactor as Player; if (player != PlayerManager.Instance.GetLocalPlayer()) { return; } switch (interactionType) { case InteractionType.INTERACTION_TRIGGER_ENTER: HandleEntry(); break; case InteractionType.INTERACTION_TRIGGER_EXIT: HandleExit(); break; default: break; } }
public void Interact(ICanInteract interactor, InteractionType interactionType) { if (!m_IsActivated) { return; } if (!GameManager.Instance.GetGameStarted()) { return; } if (!(interactor is Player) || PlayerManager.Instance.GetLocalPlayer() != (interactor as Player)) { return; } switch (interactionType) { case InteractionType.INTERACTION_TRIGGER_STAY: SetCheckpoint(); break; default: break; } }
void FixedUpdate() { // Raycasting without colliding with triggers if (Physics.Raycast(transform.position, cam.transform.forward, out hit, interactionsDistanceTemp, -5, QueryTriggerInteraction.Ignore)) { // Looking for Interactions objects, which have ICanInteract Interface ICanInteract interactibleObject = hit.collider.GetComponent <ICanInteract>(); // Activate the Ability Text playerAbilities.ShowAbilityText(true); if (interactibleObject != null) { // Update interactibleObject.Description(); if (playerInputs.Interactions) { // Launch the interaction behavior of the object StartCoroutine(interactibleObject.Interaction()); } } else { // Deactivate the Ability Text playerAbilities.ShowAbilityText(false); } } else { // Deactivate the Ability Text playerAbilities.ShowAbilityText(false); } }
public void Interact(ICanInteract interactor, InteractionType interactionType) { if (interactor != null && interactor is Player player) { switch (interactionType) { case InteractionType.INTERACTION_TRIGGER_ENTER: PlayPickUpSound(); HandlePowerUp(player); Destroy(gameObject); break; default: break; } } }
public void Interact(ICanInteract interactor, InteractionType interactionType) { if (!m_IsActivated) { return; } // Interactor should be a monobehavior // Implementer's fault if error is thrown MonoBehaviour mb = interactor as MonoBehaviour; HealthHandler healthHandler = mb.GetComponent <HealthHandler>(); if (healthHandler == null || ShouldAvoidDamage(interactor)) { return; } DealDamage(healthHandler, interactionType); }
public void Interact(ICanInteract interactor, InteractionType interactionType) { if (interactor != null && interactor is Player player) { switch (interactionType) { case InteractionType.INTERACTION_TRIGGER_ENTER: PlayPickUpSound(); HandleItemSkill(player); // E4 Hack gameObject.SetActive(false); // Destroy(gameObject); break; default: break; } } }
public void Interact(ICanInteract interactor, InteractionType interactionType) { if (!GameManager.Instance.GetGameStarted()) { return; } if (!(interactor is Player) || PlayerManager.Instance.GetLocalPlayer() != (interactor as Player)) { return; } switch (interactionType) { case InteractionType.INTERACTION_TRIGGER_ENTER: RequestGameOver(); break; default: break; } }
public void ReceiveInteraction(ICanInteract _target) { throw new System.NotImplementedException(); }
public void InteractWith(ICanInteract _target) { throw new System.NotImplementedException(); }
private bool ShouldAvoidDamage(ICanInteract interactor) { // If interactor is player, avoid getting hit by player attacks. // If interactor is monster, avoid getting hit by non-player attacks. return((interactor is Player) == m_IsPlayerAttack); }