Exemple #1
0
        // Call this to prevent a feature from being saved
        public static void RemoveSaveFeature(GameObject object_containing_save_feature)
        {
            FeatureToSave f = object_containing_save_feature.GetComponent <FeatureToSave>();

            if (f != null)
            {
                GameObject.Destroy(f);
            }
        }
Exemple #2
0
        // Call this to store the node that is running so it can executed when loaded
        // Used by SetBackground, SetBackgroundTransparent, StaticImageNode, Music nodes
        public static void SetSaveFeature(Node node_that_is_running, GameObject object_containing_save_feature)
        {
            bool found_same_feature_on_object = false;

            // Find all FeatureToSave components on this object
            foreach (FeatureToSave f in object_containing_save_feature.GetComponents <FeatureToSave>())
            {
                if (f.Type_of_Node_to_Execute.GetType() == node_that_is_running.GetType())
                {
                    found_same_feature_on_object = true;
                    f.SetFeature(node_that_is_running);
                    return;
                }
            }

            if (!found_same_feature_on_object)
            {
                FeatureToSave feature = object_containing_save_feature.AddComponent <FeatureToSave>();
                feature.SetFeature(node_that_is_running);
            }
        }