YuminekoGame
1/25/2019 - 3:56 PM

MonsterView

Unity Excel Impoterの解説記事(https://yumineko.com/game-create/unity/excel-parameter)で使用。 作成したScriptableObjectを読み込み、全要素をConsoleに出力するサンプル。

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MonsterView : MonoBehaviour {
    [SerializeField]
    private MonsterParameter param;
    // Start is called before the first frame update
    void Start () {
        for (int i = 0; i < param.Data.Count; i++) {
            Debug.Log (param.Data[i].name +
                " 属性:" + param.Data[i].element.ToString () +
                " 最大HP:" + param.Data[i].maxhp +
                " 攻撃力:" + param.Data[i].atk);
        }
    }

    // Update is called once per frame
    void Update () {

    }
}