chrisgregan
10 years ago
5 changed files with 96 additions and 16 deletions
@ -0,0 +1,53 @@ |
|||||||
|
using UnityEngine; |
||||||
|
using UnityEditor; |
||||||
|
using System.Collections; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
|
||||||
|
public class DialogMenuItems |
||||||
|
{ |
||||||
|
|
||||||
|
[MenuItem("GameObject/Fungus/Dialog/Background")] |
||||||
|
static void CreateBackground() |
||||||
|
{ |
||||||
|
InstantiatePrefab("Background"); |
||||||
|
} |
||||||
|
|
||||||
|
[MenuItem("GameObject/Fungus/Dialog/Character")] |
||||||
|
static void CreateCharacter() |
||||||
|
{ |
||||||
|
InstantiatePrefab("Character"); |
||||||
|
} |
||||||
|
|
||||||
|
[MenuItem("GameObject/Fungus/Dialog/NarratorDialog")] |
||||||
|
static void CreateNarratorDialog() |
||||||
|
{ |
||||||
|
InstantiatePrefab("NarratorDialog"); |
||||||
|
} |
||||||
|
|
||||||
|
[MenuItem("GameObject/Fungus/Dialog/SayDialog")] |
||||||
|
static void CreateSayDialog() |
||||||
|
{ |
||||||
|
InstantiatePrefab("SayDialog"); |
||||||
|
} |
||||||
|
|
||||||
|
[MenuItem("GameObject/Fungus/Dialog/ChooseDialog")] |
||||||
|
static void CreateChooseDialog() |
||||||
|
{ |
||||||
|
InstantiatePrefab("ChooseDialog"); |
||||||
|
} |
||||||
|
|
||||||
|
static void InstantiatePrefab(string prefabName) |
||||||
|
{ |
||||||
|
GameObject prefab = Resources.LoadAssetAtPath("Assets/Fungus/Dialog/Prefabs/" + prefabName + ".prefab", typeof(GameObject)) as GameObject; |
||||||
|
if (prefab != null) |
||||||
|
{ |
||||||
|
GameObject go = GameObject.Instantiate(prefab) as GameObject; |
||||||
|
go.name = prefabName; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,8 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: ce2477bdc80e3464dae8a07bf263f571 |
||||||
|
MonoImporter: |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
@ -0,0 +1,27 @@ |
|||||||
|
using UnityEngine; |
||||||
|
using UnityEditor; |
||||||
|
using System.Collections; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
|
||||||
|
public class FungusScriptMenuItems |
||||||
|
{ |
||||||
|
[MenuItem("GameObject/Fungus/Fungus Script")] |
||||||
|
static void CreateFungusScript() |
||||||
|
{ |
||||||
|
GameObject newFungusScriptGO = new GameObject(); |
||||||
|
newFungusScriptGO.name = "FungusScript"; |
||||||
|
FungusScript fungusScript = newFungusScriptGO.AddComponent<FungusScript>(); |
||||||
|
GameObject newSequenceGO = new GameObject(); |
||||||
|
newSequenceGO.transform.parent = newFungusScriptGO.transform; |
||||||
|
newSequenceGO.name = "Start"; |
||||||
|
newSequenceGO.hideFlags = HideFlags.HideInHierarchy; |
||||||
|
Sequence sequence = newSequenceGO.AddComponent<Sequence>(); |
||||||
|
fungusScript.startSequence = sequence; |
||||||
|
fungusScript.selectedSequence = sequence; |
||||||
|
Undo.RegisterCreatedObjectUndo(newFungusScriptGO, "Create Fungus Script"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,8 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: e2db84d6dd8cb4ba390719566768a071 |
||||||
|
MonoImporter: |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
Loading…
Reference in new issue