コード例 #1
0
    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;
        }
    }
コード例 #2
0
ファイル: Checkpoint.cs プロジェクト: Eclmist/Aether
    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;
        }
    }
コード例 #3
0
    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);
        }
    }
コード例 #4
0
    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;
            }
        }
    }
コード例 #5
0
    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);
    }
コード例 #6
0
ファイル: Item.cs プロジェクト: Eclmist/Aether
    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;
            }
        }
    }
コード例 #7
0
    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;
        }
    }
コード例 #8
0
 public void ReceiveInteraction(ICanInteract _target)
 {
     throw new System.NotImplementedException();
 }
コード例 #9
0
 public void InteractWith(ICanInteract _target)
 {
     throw new System.NotImplementedException();
 }
コード例 #10
0
 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);
 }