예제 #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);
        }
    }
예제 #2
0
    public static bool SafeInvoke(this UnityEvent unityEvent)
    {
        if (unityEvent.CheckUnityEventAction())
        {
            unityEvent.Invoke();
            return(true);
        }

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

        EndInput();

        bool isUnityAction = failureAction.CheckUnityEventAction();

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

        EndInput();

        bool isUnityAction = successAction.CheckUnityEventAction();

        if (isUnityAction)
        {
            successAction.Invoke();
        }
    }
예제 #5
0
    void OnTriggerExit(Collider other)
    {
        if (isColliding)
        {
            return;
        }
        isColliding = true;

        if (other.tag == Const_Tags.Player)
        {
            if (exitAction.CheckUnityEventAction())
            {
                exitAction.Invoke();
            }
        }
    }
예제 #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);
    }