Exemplo n.º 1
0
    private void OnEnter(Collider other)
    {
        bool isUnityAction      = action.CheckUnityEventAction();
        bool isCustomUnityEvent = refAction.CheckUnityEvent();

        // For actions, handle setting this to inactive in the invoked object in order to do conditionally.
        if (isUnityAction || isCustomUnityEvent)
        {
            if (isUnityAction)
            {
                action.Invoke();
            }
            if (isCustomUnityEvent)
            {
                refAction.Invoke(other.transform.GetParentRecursive <Transform>());
            }
        }
        // For entering once.
        else if (game.ActivateTrigger(Id))
        {
            Debug.Log($"{name} Entered: <{other.gameObject.name}> Setting inactive");
            this.gameObject.SetActive(false);
        }

        if (isForceHide)
        {
            this.gameObject.SetActive(false);
        }
    }
Exemplo n.º 2
0
    public static bool SafeInvoke(this UnityEvent unityEvent)
    {
        if (unityEvent.CheckUnityEventAction())
        {
            unityEvent.Invoke();
            return(true);
        }

        return(false);
    }
Exemplo n.º 3
0
    // Called from Level Behavior
    public void OnSubmitFailure()
    {
        Debug.Log($"{name} Reaction to Failure");

        EndInput();

        bool isUnityAction = failureAction.CheckUnityEventAction();

        if (isUnityAction)
        {
            failureAction.Invoke();
        }
    }
Exemplo n.º 4
0
    // Called from Level Behavior
    public void OnSubmitSuccess()
    {
        Debug.Log($"{name} Reaction to Success");

        EndInput();

        bool isUnityAction = successAction.CheckUnityEventAction();

        if (isUnityAction)
        {
            successAction.Invoke();
        }
    }
Exemplo n.º 5
0
    void OnTriggerExit(Collider other)
    {
        if (isColliding)
        {
            return;
        }
        isColliding = true;

        if (other.tag == Const_Tags.Player)
        {
            if (exitAction.CheckUnityEventAction())
            {
                exitAction.Invoke();
            }
        }
    }
Exemplo n.º 6
0
    public virtual void TurnOn()
    {
        isOn = true;
        rendererChild.GetComponent <SpriteRenderer>().sprite = onSprite;

        if (!isStateless)
        {
            game.SetSwitchState(switchId, true);
        }

        if (!isSFXOverriden)
        {
            GetComponent <AudioSource>().PlayOneShot(Script_SFXManager.SFX.SwitchOn, Script_SFXManager.SFX.SwitchOnVol);
        }

        if (onAction.CheckUnityEventAction())
        {
            onAction.Invoke();
        }
        Script_InteractableObjectEventsManager.SwitchOn(nameId);
    }