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);
    }
        private void Start()
        {
            // Go through all the Reactions and call their Init function.
            for (int i = 0; i < reactions.Length; i++)
            {
                CallbackReaction callbackReaction = reactions[i] as CallbackReaction;

                if (callbackReaction)
                {
                    callbackReaction.Init();
                    continue;
                }

                // The DelayedReaction 'hides' the Reaction's Init function with it's own.
                // This means that we have to try to cast the Reaction to a DelayedReaction and then if it exists call it's Init function.
                // Note that this mainly done to demonstrate hiding and not especially for functionality.
                DelayedReaction delayedReaction = reactions[i] as DelayedReaction;

                if (delayedReaction)
                {
                    delayedReaction.Init();
                    continue;
                }


                reactions[i].Init();
            }
        }
    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);
            }
        }
    }
Пример #5
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();
         }
     }
 }
Пример #6
0
 private void Start()
 {
     for (int i = 0; i < reactions.Length; i++)
     {
         DelayedReaction delayedReaction = reactions[i] as DelayedReaction;
         if (delayedReaction != null)
         {
             delayedReaction.Init();
         }
         else
         {
             reactions[i].Init();
         }
     }
 }
Пример #7
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);
            }
        }
    }
Пример #9
0
    //Looks through all the reactions and calls their init function
    private void Start()
    {
        for (int i = 0; i < reactions.Length; i++)
        {
            //Delayedreaction => function hiding
            DelayedReaction delayedReaction = reactions[i] as DelayedReaction;

            if (delayedReaction)
            {
                delayedReaction.Init();
            }
            else
            {
                reactions[i].Init();
            }
        }
    }
    // nie bedziemy przechowywac tablic zlozonych z animacji, dzwieku czy tekstu
    // ale prosta tablice reakcji i osiagamy to dzieki polimorfizmowi
    // zakladam ze nie musze tlumaczyc jak dziala dziedziczenie i polimorfizm


    private void Start()  // start function gonna loop through all of the reactions
    // i ona wyzwali ich initialization function
    {
        for (int i = 0; i < reactions.Length; i++)
        {
            DelayedReaction delayedReaction = reactions[i] as DelayedReaction;

            if (delayedReaction)
            {
                delayedReaction.Init();
            }
            else
            {
                reactions[i].Init();
            }
        }
    }
    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);
            }
        }
    }
    private void Start()
    {
        audioSourceForTalk = GameObject.Find("EffectSound_For_Click").GetComponent <AudioSource>();
        audioClipForTalk   = Resources.Load <AudioClip>("AudioResource/EffectSound/S_Click");

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

            if (delayedReaction)
            {
                delayedReaction.Init();
            }
            else
            {
                reactions[i].Init();
            }
        }
    }
 // Use this for initialization
 private void Start()
 {
     // Go through all Reactions
     for (int i = 0; i < reactions.Length; i++)
     {
         // (Function Hiding) Cast As Delayed Reaction
         DelayedReaction delayedReaction = reactions[i] as DelayedReaction;
         // If there is a DelayedReaction
         if (delayedReaction)
         {
             // Initialize the DelayedReaction
             delayedReaction.Init();
             // Otherwise:
         }
         else
         {
             // Initialize the Reaction
             reactions[i].Init();
         }
     }
 }
    // 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 InitIndex()
    {
        startIndex = 0;

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

            if (delayedReaction)
            {
                delayedReaction.Init();
            }
            else
            {
                reactions[i].Init();
            }
        }

        if (FSLocator.textDisplayer != null)
        {
            FSLocator.textDisplayer.reactionButton.onClick.RemoveAllListeners();
        }
    }
    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);
                }
            }
        }
    }