Exemplo n.º 1
0
 public void ActivateNextEvent()
 {
     if (nextEvent != null)
     {
         nextEvent.MakeActive(true);
     }
 }
Exemplo n.º 2
0
    public static void InvokeAction(PopEvent popEvent)
    {
        popEvent.hasExecuted = true;
        bool destroyAfterwards = false;

        foreach (EventHalf action in popEvent.actions)
        {
            if (action.args == null)
            {
                action.SetParameters();
            }
            if (action.args.Length > 5)
            {
                Debug.Warning("core", "Event functions cannot have more than 5 parameters");
                continue;
            }
            if (action.e_categoryString == "Static Script")
            {
                EventLibrary.staticClasses[action.e_classString].GetMethod(action.e_fieldString).Invoke(null, action.args);
            }
            //			else if (action.e_categoryString == "GUI") {
            //				if (action.e_classString == "Set Objective") {
            //					GameHUD.UpdateObjectiveText(action.p_string[0]);
            //				}else if (action.e_classString == "Set Dialogue") {
            //					GameHUD.SetDialogueBoxText(action.p_string[0], action.p_string[1]);
            //				}
            //			}
            else if (action.e_categoryString == "System")
            {
                if (action.e_classString == "Debug Message")
                {
                    Debug.Log("event", action.p_string[0]);
                    //MonoBehaviour.print(action.p_string[0]);
                }
                else if (action.e_classString == "Activate Next Event")
                {
                    popEvent.ActivateNextEvent();
                }
                else if (action.e_classString == "Activate Another Event")
                {
                    ActivateById(action.p_string[0], true);
                }
                else if (action.e_classString == "Deactivate Another Event")
                {
                    ActivateById(action.p_string[0], false);
                }
                else if (action.e_classString == "Create Prefab At Position")
                {
                    if (action.p_GameObject[0] != null)
                    {
                        MonoBehaviour.Instantiate(action.p_GameObject[0], action.p_Vector3[0], Quaternion.Euler(action.p_Vector3[1]));
                    }
                }
                else if (action.e_classString == "Create Prefab Here")
                {
                    if (action.p_GameObject[0] != null)
                    {
                        MonoBehaviour.Instantiate(action.p_GameObject[0], popEvent.gameObject.transform.position, Quaternion.identity);
                    }
                }
                else if (action.e_classString == "Move This Object")
                {
                    popEvent.gameObject.transform.position    = action.p_Vector3[0];
                    popEvent.gameObject.transform.eulerAngles = action.p_Vector3[1];
                }
                else if (action.e_classString == "Destroy This Object")
                {
                    destroyAfterwards = true;
                }
            }
            else
            {
                if (action.e_fieldString != string.Empty && action.e_MonoBehaviour != null)
                {
                    action.e_MonoBehaviour.GetType().GetMethod(action.e_fieldString).Invoke(action.e_MonoBehaviour, action.args);
                }
            }
        }
        if (popEvent.executeOnce == true)
        {
            popEvent.MakeActive(false);
        }
        if (destroyAfterwards == true)
        {
            MonoBehaviour.Destroy(popEvent.gameObject);
        }
    }
Exemplo n.º 3
0
 public static void InvokeAction(PopEvent popEvent)
 {
     popEvent.hasExecuted = true;
     bool destroyAfterwards = false;
     foreach (EventHalf action in popEvent.actions)
     {
         if (action.args == null)
         {
             action.SetParameters();
         }
         if (action.args.Length > 5)
         {
             Debug.Warning("core", "Event functions cannot have more than 5 parameters");
             continue;
         }
         if (action.e_categoryString == "Static Script")
         {
             EventLibrary.staticClasses[action.e_classString].GetMethod(action.e_fieldString).Invoke(null, action.args);
         }
         //			else if (action.e_categoryString == "GUI") {
         //				if (action.e_classString == "Set Objective") {
         //					GameHUD.UpdateObjectiveText(action.p_string[0]);
         //				}else if (action.e_classString == "Set Dialogue") {
         //					GameHUD.SetDialogueBoxText(action.p_string[0], action.p_string[1]);
         //				}
         //			}
         else if (action.e_categoryString == "System")
         {
             if (action.e_classString == "Debug Message")
             {
                 Debug.Log("event", action.p_string[0]);
                 //MonoBehaviour.print(action.p_string[0]);
             }
             else if (action.e_classString == "Activate Next Event")
             {
                 popEvent.ActivateNextEvent();
             }
             else if (action.e_classString == "Activate Another Event")
             {
                 ActivateById(action.p_string[0], true);
             }
             else if (action.e_classString == "Deactivate Another Event")
             {
                 ActivateById(action.p_string[0], false);
             }
             else if (action.e_classString == "Create Prefab At Position")
             {
                 if (action.p_GameObject[0] != null)
                 {
                     MonoBehaviour.Instantiate(action.p_GameObject[0], action.p_Vector3[0], Quaternion.Euler(action.p_Vector3[1]));
                 }
             }
             else if (action.e_classString == "Create Prefab Here")
             {
                 if (action.p_GameObject[0] != null)
                 {
                     MonoBehaviour.Instantiate(action.p_GameObject[0], popEvent.gameObject.transform.position, Quaternion.identity);
                 }
             }
             else if (action.e_classString == "Move This Object")
             {
                 popEvent.gameObject.transform.position = action.p_Vector3[0];
                 popEvent.gameObject.transform.eulerAngles = action.p_Vector3[1];
             }
             else if (action.e_classString == "Destroy This Object")
             {
                 destroyAfterwards = true;
             }
         }
         else
         {
             if (action.e_fieldString != string.Empty && action.e_MonoBehaviour != null)
             {
                 action.e_MonoBehaviour.GetType().GetMethod(action.e_fieldString).Invoke(action.e_MonoBehaviour, action.args);
             }
         }
     }
     if (popEvent.executeOnce == true)
     {
         popEvent.MakeActive(false);
     }
     if (destroyAfterwards == true)
     {
         MonoBehaviour.Destroy(popEvent.gameObject);
     }
 }