public void React(Interactable publisher)
        {
            // Go through all the Reactions and call their React function.
            for (int i = 0; i < reactions.Length; i++)
            {
                CallbackReaction callbackReaction = reactions[i] as CallbackReaction;

                if (callbackReaction)
                {
                    callbackReaction.React(ref publisher);
                    continue;
                }

                // The DelayedReaction hides the Reaction.React function.
                // Note again this is mainly done for demonstration purposes.
                DelayedReaction delayedReaction = reactions[i] as DelayedReaction;

                if (delayedReaction)
                {
                    delayedReaction.React(ref publisher);
                    continue;
                }

                reactions[i].React(ref publisher);
            }
        }
Пример #2
0
    public bool React()
    {
        if (!Condition.Evaluate())
        {
            return(false);
        }

        // Go through all the Reactions and call their React function.
        for (int i = 0; i < reactions.Length; i++)
        {
            // The DelayedReaction hides the Reaction.React function.
            // Note again this is mainly done for demonstration purposes.
            DelayedReaction delayedReaction = reactions[i] as DelayedReaction;

            if (delayedReaction)
            {
                delayedReaction.React(GameObject);
            }
            else
            {
                reactions[i].React(GameObject);
            }
        }
        return(true);
    }
    public void React()
    {
        if (alreadyReacted && onlyReactOnce)
        {
            return;
        }

        alreadyReacted = true;

        // Go through all the Reactions and call their React function.
        for (int i = 0; i < reactions.Length; i++)
        {
            // The DelayedReaction hides the Reaction.React function.
            // Note again this is mainly done for demonstration purposes.
            DelayedReaction delayedReaction = reactions[i] as DelayedReaction;

            if (delayedReaction)
            {
                delayedReaction.React(this);
            }
            else
            {
                reactions[i].React(this);
            }
        }
    }
Пример #4
0
 public void React()
 {
     for (int i = 0; i < reactions.Length; i++)
     {
         DelayedReaction delayedReaction = reactions[i] as DelayedReaction;
         if (delayedReaction != null)
         {
             delayedReaction.React();
         }
         else
         {
             reactions[i].React();
         }
     }
 }
Пример #5
0
 public void React(MonoBehaviour mono)
 {
     for (int i = 0; i < reactions.Length; i++)
     {
         DelayedReaction delayed = reactions[i] as DelayedReaction;
         if (delayed)
         {
             delayed.React(mono);
         }
         else
         {
             reactions[i].React();
         }
     }
 }
    public void React()  // again looping through all of reactions and calling their react
    {
        for (int i = 0; i < reactions.Length; i++)
        {
            DelayedReaction delayedReaction = reactions[i] as DelayedReaction;

            if (delayedReaction)
            {
                delayedReaction.React(this);
            }
            else
            {
                reactions[i].React(this);
            }
        }
    }
    public void React()
    {
        // Go through all the Reactions and call their React function.
        for (int i = 0; i < reactions.Length; i++)
        {
            // The DelayedReaction hides the Reaction.React function.
            // Note again this is mainly done for demonstration purposes.
            DelayedReaction delayedReaction = reactions[i] as DelayedReaction;

            if (delayedReaction)
            {
                delayedReaction.React(this);
            }
            else if (reactions[i] != null)
            {
                reactions[i].React(this);
            }
        }
    }
    // Function to React with Interactables (Delayed and Immediate)
    public void React()
    {
        // Go through the ReactionCollection
        for (int i = 0; i < reactions.Length; i++)
        {
            // (Function Hiding) Cast Delayed Reactions
            DelayedReaction delayedReaction = reactions[i] as DelayedReaction;

            // If there is a DelayedReaction
            if (delayedReaction)
            {
                // Start the Delayed Reaction
                delayedReaction.React(this);
                // Otherwise if there is No Delayed Reaction
            }
            else
            {
                // Start the React Immediate
                reactions[i].React(this);
            }
        }
    }
    public void React()
    {
        if (reactions.Length == 0)
        {
            return;
        }

        if (startIndex == 0)
        {
            if (FSLocator.textDisplayer != null)
            {
                FSLocator.textDisplayer.StopAllCoroutines();
            }
        }
        else if (FSLocator.textDisplayer.isTyping)
        {
            FSLocator.textDisplayer.SkipTypingLetter();
            FSLocator.textDisplayer.reactionButton.onClick.RemoveAllListeners();
            FSLocator.textDisplayer.reactionButton.onClick.AddListener(delegate { this.React(); });
            return;
        }

        string reactionName = "";

        for (int i = startIndex; i < reactions.Length; i++)
        {
            DelayedReaction delayedReaction = reactions[i] as DelayedReaction;

            if (delayedReaction)
            {
                FSLocator.textDisplayer.reactionButton.enabled = false;

                if (beforeTextReaction == true)
                {
                    audioSourceForTalk.clip = audioClipForTalk;
                    audioSourceForTalk.Play();
                    beforeTextReaction = false;
                }

                reactionName = reactions[i].GetType().Name;
                if (reactionName == "TextReaction")
                {
                    FSLocator.textDisplayer.reactionButton.enabled = true;

                    beforeTextReaction = true;
                    startIndex         = i + 1;
                    delayedReaction.React(this);
                    FSLocator.textDisplayer.reactionButton.onClick.RemoveAllListeners();
                    FSLocator.textDisplayer.reactionButton.onClick.AddListener(delegate { this.React(); });
                    return;
                }
                else if (reactionName == "DelayReaction")
                {
                    startIndex = i + 1;
                    FSLocator.textDisplayer.reactionButton.onClick.RemoveAllListeners();
                    FSLocator.textDisplayer.reactionButton.onClick.AddListener(delegate { this.React(); });
                    delayedReaction.React(this);
                    return;
                }
                else if (reactionName == "CutSceneStartReaction")
                {
                    startIndex = i + 1;
                    FSLocator.textDisplayer.reactionButton.onClick.RemoveAllListeners();
                    FSLocator.textDisplayer.reactionButton.onClick.AddListener(delegate { this.React(); });
                    delayedReaction.React(this);
                    return;
                }
                else if (reactionName == "CutSceneEndReaction")
                {
                    startIndex = i + 1;
                    FSLocator.textDisplayer.reactionButton.onClick.RemoveAllListeners();
                    FSLocator.textDisplayer.reactionButton.onClick.AddListener(delegate { this.React(); });
                    delayedReaction.React(this);
                    return;
                }
                else if (reactionName == "CharacterMoveReaction")
                {
                    startIndex = i + 1;
                    FSLocator.textDisplayer.reactionButton.onClick.RemoveAllListeners();
                    FSLocator.textDisplayer.reactionButton.onClick.AddListener(delegate { this.React(); });
                    delayedReaction.React(this);
                    return;
                }
                else if (reactionName == "CameraMoveReaction")
                {
                    startIndex = i + 1;
                    FSLocator.textDisplayer.reactionButton.onClick.RemoveAllListeners();
                    FSLocator.textDisplayer.reactionButton.onClick.AddListener(delegate { this.React(); });
                    delayedReaction.React(this);
                    return;
                }
                else if (reactionName == "CameraZoomInReaction")
                {
                    startIndex = i + 1;
                    FSLocator.textDisplayer.reactionButton.onClick.RemoveAllListeners();
                    FSLocator.textDisplayer.reactionButton.onClick.AddListener(delegate { this.React(); });
                    delayedReaction.React(this);
                    return;
                }
                else if (reactionName == "CameraZoomOutReaction")
                {
                    startIndex = i + 1;
                    FSLocator.textDisplayer.reactionButton.onClick.RemoveAllListeners();
                    FSLocator.textDisplayer.reactionButton.onClick.AddListener(delegate { this.React(); });
                    delayedReaction.React(this);
                    return;
                }
                else if (reactionName == "PushBackReaction")
                {
                    startIndex = i + 1;
                    FSLocator.textDisplayer.reactionButton.onClick.RemoveAllListeners();
                    FSLocator.textDisplayer.reactionButton.onClick.AddListener(delegate { this.React(); });
                    delayedReaction.React(this);
                    return;
                }
                else if (reactionName == "GameOverReaction")
                {
                    startIndex = i + 1;
                    FSLocator.textDisplayer.reactionButton.onClick.RemoveAllListeners();
                    FSLocator.textDisplayer.reactionButton.onClick.AddListener(delegate { this.React(); });
                    delayedReaction.React(this);
                    return;
                }
                else if (reactionName == "ObservationReaction")
                {
                    FSLocator.textDisplayer.reactionButton.enabled = true;

                    startIndex = i + 1;
                    FSLocator.textDisplayer.reactionButton.onClick.RemoveAllListeners();
                    FSLocator.textDisplayer.reactionButton.onClick.AddListener(delegate { this.React(); });
                    delayedReaction.React(this);
                    return;
                }
                else if (reactionName == "MoveDistanceCheckReaction")
                {
                    startIndex = i + 1;
                    FSLocator.textDisplayer.reactionButton.onClick.RemoveAllListeners();
                    FSLocator.textDisplayer.reactionButton.onClick.AddListener(delegate { this.React(); });
                    delayedReaction.React(this);
                    return;
                }
                else if (reactionName == "WaitingUntilClickMissionReaction")
                {
                    startIndex = i + 1;
                    FSLocator.textDisplayer.reactionButton.onClick.RemoveAllListeners();
                    FSLocator.textDisplayer.reactionButton.onClick.AddListener(delegate { this.React(); });
                    delayedReaction.React(this);
                    return;
                }
                else if (reactionName == "WaitingUntilClickInventoryReaction")
                {
                    startIndex = i + 1;
                    FSLocator.textDisplayer.reactionButton.onClick.RemoveAllListeners();
                    FSLocator.textDisplayer.reactionButton.onClick.AddListener(delegate { this.React(); });
                    delayedReaction.React(this);
                    return;
                }
                else if (reactionName == "WaitingUntilClickDocuInfoReaction")
                {
                    startIndex = i + 1;
                    FSLocator.textDisplayer.reactionButton.onClick.RemoveAllListeners();
                    FSLocator.textDisplayer.reactionButton.onClick.AddListener(delegate { this.React(); });
                    delayedReaction.React(this);
                    return;
                }
                else if (reactionName == "WaitingUntilClickDocuCharReaction")
                {
                    startIndex = i + 1;
                    FSLocator.textDisplayer.reactionButton.onClick.RemoveAllListeners();
                    FSLocator.textDisplayer.reactionButton.onClick.AddListener(delegate { this.React(); });
                    delayedReaction.React(this);
                    return;
                }
                else if (reactionName == "WaitingUntilMixReaction")
                {
                    startIndex = i + 1;
                    FSLocator.textDisplayer.reactionButton.onClick.RemoveAllListeners();
                    FSLocator.textDisplayer.reactionButton.onClick.AddListener(delegate { this.React(); });
                    delayedReaction.React(this);
                    return;
                }
                else if (reactionName == "WatingUntilClickSaveReaction")
                {
                    startIndex = i + 1;
                    FSLocator.textDisplayer.reactionButton.onClick.RemoveAllListeners();
                    FSLocator.textDisplayer.reactionButton.onClick.AddListener(delegate { this.React(); });
                    delayedReaction.React(this);
                    return;
                }
                else if (reactionName == "EventCallbackReaction" ||
                         reactionName == "EventCallbackConditionReaction" ||
                         reactionName == "EventConditionReaction")
                {
                    startIndex = 0;
                    delayedReaction.React(this);
                    return;
                }
                else
                {
                    FSLocator.textDisplayer.reactionButton.enabled = true;

                    delayedReaction.React(this);
                }
            }
        }
    }