示例#1
0
    public override bool Load()
    {
        MonsterStat targetData = target as MonsterStat;

        var    client = new DatabaseClient("", "");
        string error  = string.Empty;
        var    db     = client.GetDatabase(targetData.SheetName, ref error);
        var    table  = db.GetTable <MonsterStatData>(targetData.WorksheetName) ?? db.CreateTable <MonsterStatData>(targetData.WorksheetName);

        List <MonsterStatData> myDataList = new List <MonsterStatData>();

        var all = table.FindAll();

        foreach (var elem in all)
        {
            MonsterStatData data = new MonsterStatData();

            data = Cloner.DeepCopy <MonsterStatData>(elem.Element);
            myDataList.Add(data);
        }

        targetData.dataArray = myDataList.ToArray();

        EditorUtility.SetDirty(targetData);
        AssetDatabase.SaveAssets();

        return(true);
    }
示例#2
0
    public virtual void InitMonster(string name)
    {
        MonsterStatData stat = MonsterManager.Instance.GetMonsterStat(name);

        mMonsterName = stat.Name;
        mMonsterHP   = stat.HP;
        mMonsterIdx  = stat.Idx;
        mMoveSpd     = stat.Movespd;
        mFsmTime     = stat.Fsmtime;

        SetState(eMonster_State.eState_Before_Spawn);
    }
示例#3
0
    public MonsterStatData GetMonsterStat(string name)
    {
        MonsterStatData stat = null;

        if (m_MonsterStatData == null)
        {
            LoadMonsterTable();
        }
        for (int i = 0; i < m_MonsterStatData.dataArray.Length; i++)
        {
            if (m_MonsterStatData.dataArray[i].Name == name)
            {
                stat = m_MonsterStatData.dataArray[i];
                return(stat);
            }
        }
        return(stat);
    }