Example #1
0
    public void AddModule(Module.TYPE type)
    {
        if (System.Array.Find(Modules, x => x.Type() == type))
        {
            Debug.Log("Module of type " + type.ToString() + " already exists.");
        }
        else
        {
            switch (type)
            {
            case Module.TYPE.Style:
                ArrayExtensions.Add(ref Modules, ScriptableObject.CreateInstance <StyleModule>().Initialise(this));
                break;

            case Module.TYPE.Phase:
                ArrayExtensions.Add(ref Modules, ScriptableObject.CreateInstance <PhaseModule>().Initialise(this));
                break;

            case Module.TYPE.Contact:
                ArrayExtensions.Add(ref Modules, ScriptableObject.CreateInstance <ContactModule>().Initialise(this));
                break;

            case Module.TYPE.DepthMap:
                ArrayExtensions.Add(ref Modules, ScriptableObject.CreateInstance <DepthMapModule>().Initialise(this));
                break;

            case Module.TYPE.HeightMap:
                ArrayExtensions.Add(ref Modules, ScriptableObject.CreateInstance <HeightMapModule>().Initialise(this));
                break;
            }
            AssetDatabase.AddObjectToAsset(Modules[Modules.Length - 1], this);
        }
    }
Example #2
0
    public void AddModule(Module.TYPE type)
    {
        if (System.Array.Find(Modules, x => x.Type() == type))
        {
            Debug.Log("Module of type " + type.ToString() + " already exists.");
        }
        else
        {
            switch (type)
            {
            case Module.TYPE.Trajectory:
                ArrayExtensions.Add(ref Modules, ScriptableObject.CreateInstance <TrajectoryModule>().Initialise(this));
                break;

            case Module.TYPE.Style:
                ArrayExtensions.Add(ref Modules, ScriptableObject.CreateInstance <StyleModule>().Initialise(this));
                break;

            case Module.TYPE.Phase:
                ArrayExtensions.Add(ref Modules, ScriptableObject.CreateInstance <PhaseModule>().Initialise(this));
                break;

            default:
                Debug.Log("Module of type " + type.ToString() + " not considered.");
                return;
            }
            AssetDatabase.AddObjectToAsset(Modules[Modules.Length - 1], this);
        }
    }
Example #3
0
    public void RemoveModule(Module.TYPE type)
    {
        Module module = GetModule(type);

        if (!module)
        {
            Debug.Log("Module of type " + type.ToString() + " does not exist.");
        }
        else
        {
            ArrayExtensions.Remove(ref Modules, module);
            Utility.Destroy(module);
        }
    }
Example #4
0
 public Module GetModule(Module.TYPE type)
 {
     return(System.Array.Find(Modules, x => x.Type() == type));
 }