コード例 #1
0
    /// <summary>
    /// Called when the object is selected in the editor
    /// </summary>
    private void OnEnable()
    {
        // Grab the serialized objects
        mTarget   = (ActorController)target;
        mTargetSO = new SerializedObject(target);

        // Reinstanciate any of the body shapes
        mTarget.DeserializeBodyShapes();

        // Create the list of body shapes
        InstanciateList();

        // Generate the list of motions to display
        Assembly lAssembly = Assembly.GetAssembly(typeof(ActorController));

        foreach (Type lType in lAssembly.GetTypes())
        {
            if (lType.IsAbstract)
            {
                continue;
            }
            if (typeof(BodyShape).IsAssignableFrom(lType))
            {
                mBodyShapeTypes.Add(lType);
                mBodyShapeNames.Add(StringHelper.FormatCamelCase(lType.Name));
            }
        }

        // Initialize the component for the first time.
        if (!mTarget.EditorComponentInitialized)
        {
            if (mTarget.BodyShapes.Count == 0)
            {
                CreateDefaultShapes();

                mTarget.EditorComponentInitialized = true;
                mIsDirty = true;
            }
        }

        // Refresh the layers in case they were updated
        EditorHelper.RefreshLayers();
    }
コード例 #2
0
    /// <summary>
    /// Called when the object is selected in the editor
    /// </summary>
    private void OnEnable()
    {
        // Grab the serialized objects
        mTarget = (ActorController)target;
        mTargetSO = new SerializedObject(target);

        // Reinstanciate any of the body shapes
        mTarget.DeserializeBodyShapes();

        // Create the list of body shapes
        InstanciateList();

        // Generate the list of motions to display
        Assembly lAssembly = Assembly.GetAssembly(typeof(ActorController));
        foreach (Type lType in lAssembly.GetTypes())
        {
            if (lType.IsAbstract) { continue; }
            if (typeof(BodyShape).IsAssignableFrom(lType))
            {
                mBodyShapeTypes.Add(lType);
                mBodyShapeNames.Add(StringHelper.FormatCamelCase(lType.Name));
            }
        }

        // Initialize the component for the first time.
        if (!mTarget.EditorComponentInitialized)
        {
            if (mTarget.BodyShapes.Count == 0)
            {
                CreateDefaultShapes();

                mTarget.EditorComponentInitialized = true;
                mIsDirty = true;
            }
        }

        // Refresh the layers in case they were updated
        EditorHelper.RefreshLayers();
    }