Beispiel #1
0
    public static GameObject CreateEntity(UnityEngine.Object entity, string selectStateID = "")
    {
        GameObject gameObject = null;

        if (entity is EditorMonster)
        {
            EditorMonster editorMonster = entity as EditorMonster;
            Debug.Log(editorMonster.name);
            gameObject = SceneUtils.CreateEntityInScene(string.Format("Assets/Resources/{0}.prefab", editorMonster.path), editorMonster.name);
            //SceneCache.AddToList<ScriptableObjectMonster>(ScriptableObjectMonster.Create(gameObject.transform, editorMonster.path, selectStateID, editorMonster.monsterId, editorMonster.name), DungeonCache.MonsterList);
        }
        gameObject.transform.SetParent(SceneCache.dungeonRoot);
        SceneCache.OnCacheChange();
        gameObject.layer = 9;
        return(gameObject);
    }
Beispiel #2
0
    private void UpdateMonster()
    {
        this.monsterList = new List <EditorMonster>();

        Object[] gameObjects = Resources.LoadAll("Monster");

        int num = 0;

        foreach (var item in gameObjects)
        {
            num++;
            EditorMonster editorMonster = ScriptableObject.CreateInstance <EditorMonster>();
            editorMonster.dir  = "Monster";
            editorMonster.path = "Monster/" + item.name;
            UnityEngine.Object @object = editorMonster;
            @object.name            = item.name;
            editorMonster.monsterId = num;
            editorMonster.GO        = Resources.Load("woodSword") as Texture;
            this.monsterList.Add(editorMonster);
        }
        this.monsterList.Sort((EditorMonster x, EditorMonster y) => x.monsterId.CompareTo(y.monsterId));
    }