Пример #1
0
        public void StartNewConversation()
        {
            conversation_to_start.Start_Conversation();
            this.transform.GetComponentInParent <ConversationManager>().Finish_Conversation();

            //        Finish_Node();
        }
 void Update()
 {
     if (Input.anyKeyDown)
     {
         conversation_to_start.Start_Conversation();
         Destroy(this);
     }
 }
Пример #3
0
        // Destroys this game object.
        // Be sure to have added a StartConversationNode or LoadSceneNode before the conversation is over,
        // else nothing will happen!
        public void Finish_Conversation()
        {
            Reset_Conversation();

            finished_conversation = true;

            if (destroy_when_finished)
            {
                Destroy(this.gameObject);
            }

            if (start_conversation_when_done)
            {
                start_conversation_when_done.Start_Conversation();
            }
        }
Пример #4
0
        public IEnumerator Start_Scene()
        {
            yield return(null);

            //try
            //{
            if (starting_conversation != null)
            {
                starting_conversation.Start_Conversation();
            }
            else
            {
                Debug.Log("Starting_conversation is null, please set this in the VNSceneManager", this.gameObject);
            }
            //}

            /*catch (Exception e)
             * {
             *  Debug.Log("No starting Conversation set. Drag in a Conversation into the SceneManager's Starting Conversation field.\n" + e.Message, gameObject);
             * }*/
        }
Пример #5
0
 // Starts the designated conversation, and stops the current conversation
 public void Change_Conversation(ConversationManager conversation_to_start)
 {
     VNSceneManager.current_conversation.Finish_Conversation();
     conversation_to_start.Start_Conversation();
 }
Пример #6
0
 public void Start_Conversation(ConversationManager conversation)
 {
     conversation.Start_Conversation();
 }
        // Used to fix minor bug of UI appearing and it registering this same click on the UI
        IEnumerator Delay_Starting_Conversation()
        {
            yield return(new WaitForSeconds(0.01f));

            conversation_to_start.Start_Conversation();
        }
Пример #8
0
        public IEnumerator Running()
        {
            // Wait a frame so we can evaluate if objects we check for requirements have been destroyed
            yield return(0);

            bool conditions_met = true;

            for (int x = 0; x < Number_Of_Conditions; x++)
            {
                bool cur_condition = false;

                // Evaluate each condition sequentially
                switch (Conditions[x])
                {
                case Condition.Bool_Stat_Requirement:
                    cur_condition = StatsManager.Compare_Bool_Stat_To(Stat_Name[x], Bool_Compare_Value[x]);
                    break;


                case Condition.Float_Stat_Requirement:
                    cur_condition = StatsManager.Compare_Float_Stat(Stat_Name[x], Float_Stat_Is[x], Float_Compare_Value[x]);
                    break;

                case Condition.String_Stat_Requirement:
                    bool the_same = true;
                    switch (String_Is[x])
                    {
                    case Result.Is:
                        the_same = true;
                        break;

                    case Result.Is_Not:
                        the_same = false;
                        break;
                    }
                    cur_condition = StatsManager.Compare_String_Stat_To(Stat_Name[x], String_Compare_Value[x], the_same);
                    break;

                case Condition.Object_Is_Null:
                    // Check if object exists
                    // If the object doesn't exist, and the box is checked
                    // OR  the object exists and the box is not checked
                    cur_condition = Check_Null_Object[x] && !Bool_Compare_Value[x];
                    break;

                case Condition.Object_Is_Active:
                    // Check if the gameobject is enabled
                    cur_condition = Check_Active_Object[x].activeSelf && Bool_Compare_Value[x];
                    break;
                }

                // Check if need to keep going with AND's or OR's
                if (x == 0)
                {
                    // First condition, nothing to AND or OR with
                    conditions_met = cur_condition;
                }
                else if (x < Number_Of_Conditions)
                {
                    // Must AND or OR the previous condition
                    switch (Logic[x - 1])
                    {
                    case Boolean_Logic.And:
                        conditions_met = conditions_met && cur_condition;
                        break;

                    case Boolean_Logic.Or:
                        conditions_met = conditions_met || cur_condition;
                        break;
                    }
                }
            }

            if ((Is_Condition_Met == Condition_Is.Met && conditions_met) ||
                (Is_Condition_Met == Condition_Is.Not_Met && !conditions_met))
            {
                switch (Action)
                {
                case Requirement_Met_Action.Change_Conversation:
                    if (Conversation_To_Switch_To != null)
                    {
                        Conversation_To_Switch_To.Start_Conversation();
                    }
                    else
                    {
                        Debug.LogError("No conversation to switch to", this.gameObject);
                    }
                    break;

                case Requirement_Met_Action.Jump_to_Middle_of_Conversation:
                    if (!Node_To_Switch_To)
                    {
                        Debug.LogError("Node to switch to not set in IfNode", gameObject);
                        break;
                    }

                    ConversationManager cm = Node_To_Switch_To.GetComponentInParent <ConversationManager>();
                    if (cm)
                    {
                        cm.Start_At_Node(Node_To_Switch_To);
                    }
                    else
                    {
                        Debug.LogError("Couldn't find Conversation associated with Node: " + Node_To_Switch_To.name, gameObject);
                    }
                    break;

                case Requirement_Met_Action.Custom_Events:
                    Custom_Actions.Invoke();

                    if (Continue_Conversation)
                    {
                        Finish_Node();
                    }
                    break;
                }
            }
            else
            {
                // Just continue conversation
                Finish_Node();
            }
        }