Beispiel #1
0
    //APPENDAGES
    void AddAppendageButton()
    {
        if (GUILayout.Button("Add a new appendage") || adding)
        {
            GUILayout.Label("Make sure the colliders are ready!");
            adding = true;


            //NAME
            GUILayout.BeginHorizontal(GUIStyle.none);
            GUILayout.Label("Appendage Name:");
            appendageName = GUILayout.TextField(appendageName);
            GUILayout.EndHorizontal();

            //TYPE
            appType = (AppendageData.AppendageType)EditorGUILayout.EnumPopup("Type of Appendage", appType);

            //COLLIDER
            appendageColliderIndex = EditorGUILayout.Popup(appendageColliderIndex, colliderNames.ToArray());



            //FINISH BUTTON
            if (GUILayout.Button("Finish appendage") && appendageName.Length > 0)
            {
                DealWithAppendage(appendageName, appType, appendageColliderIndex);
                adding = false;
            }
        }
    }
Beispiel #2
0
    //fills in the appendage info given inputs
    void DealWithAppendage(string appName, AppendageData.AppendageType type, int index)
    {
        Appendage newAppendage = thisTarget.gameObject.AddComponent <Appendage>();

        newAppendage.baseAppendageData               = ScriptableObject.CreateInstance <AppendageData>();
        newAppendage.baseAppendageData.limbName      = appName;
        newAppendage.baseAppendageData.appendageType = type;
        newAppendage.collider = colliders[index];
        thisTarget.appendages.Add(newAppendage);

        AssetDatabase.CreateAsset(newAppendage.baseAppendageData, path + "/" + target.name + "/" + appName + ".asset");
        AssetDatabase.SaveAssets();
    }
Beispiel #3
0
    void AutoAddAppendages()
    {
        Debug.Log("You may have to manually put in appendage types");

        ObtainAppendageColliders();
        //if its a human
        if (thisTarget.humanoid)
        {
            for (int i = 0; i < colliders.Length; ++i)
            {
                //type needs to be similar to the collider name
                AppendageData.AppendageType type = FindAppendageType(colliderNames[i]);
                //AppendageData.AppendageType.
                //add the appendage
                DealWithAppendage(colliderNames[i], type, i);
            }
        }
    }