본문 바로가기
C#프로그래밍

데미지, hp 가져오기

by 노재두내 2023. 7. 26.
public Monster(Dictionary<int, ItemData> dicItemDatas, MonsterData monsterData)
        {
            this.monsterData = monsterData;
            this.dicItemDatas = dicItemDatas;
            this.hp = this.monsterData.hp;
        }

monsterData.hp는 변하면 안되니까 this.hp에다가 담는다.

public void HitDamage(int damage)
        {
            this.hp -= damage;
        }

이것도 마찬가지로 hp는 변하면 안되니까 this.hp를 변화시킨다.