public MonsterListSaveData(int count, MonsterSaveData[] monsterSaveDatas)
 {
     this.count = count;
     this.monsterSaveDatas = monsterSaveDatas;
 }
Esempio n. 2
0
    public void ApplySaveData(MonsterSaveData data)
    {
        _MonsterIndex = data.monsterIndex;
        _Pos = data.pos;
        _MaxHP = data.maxHP;
        _HP = data.hp;
        _MinAttackPower = data.minAttackPower;
        _MaxAttackPower = data.maxAttackPower;
        _MinCriAttackPower = data.minCriAttackPower;
        _MaxCriAttackPower = data.maxCriAttackPower;
        _CriticalProbability = data.criticalProbability;

        _HalfAreaX = data.halfAreaX;
        _HalfAreaY = data.halfAreaY;
        _CachedTransform.localScale = new Vector3(data.scaleX, 1, 1);
        _Speed = data.speed;
        _IsDead = false;

        InvalidateHPBar();

        _CachedTransform.position = _Pos.vector;

        CurTile.SetState(TileState.MONSTER, false);
    }
    public void SaveMonsterData()
    {
        var monsterDataArr = new MonsterSaveData[_MonsterList.Count];

        for(int i = 0; i < _MonsterList.Count; ++i)
        {
            monsterDataArr[i] = _MonsterList[i].CreateSaveData();
        }

        var monsterListData = new MonsterListSaveData(_MonsterList.Count, monsterDataArr);

        SaveLoad.SaveData("MonsterListSaveData", monsterListData);
    }