"Monster가 null 입니다"
미해결
[C#과 유니티로 만드는 MMORPG 게임 개발 시리즈] Part1: C# 기초 프로그래밍 입문
Monster monster 를 선언할때 monster의 값이 null 이라고 뜹니다. 실행을 계속해서 값을 바꾸려고 해도 계속 null입니다 Monster 클래스: public enum MonsterType { None = 0, Slime = 1, Orc = 2, Skeleton = 3, } class Monster : Creature { protected MonsterType type; protected Monster(MonsterType type) : base(CreatureType.Monster) { } public int GetHp() { return hp; } public int GetAttack() { return attack; } public bool IsDead() { return hp <= 0; } public void Ondamaged(int damage) { this.hp -= damage; if (this.hp < 0) { this.hp = 0; } } public MonsterType GetmonsterType() { return type; } } class Orc : Monster { public Orc() : base(MonsterType.Orc) { type = MonsterType.Orc; SetInfo(60, 18); } } class Slime : Monster { public Slime() : base(MonsterType.Slime) { type = MonsterType.Slime; SetInfo(35, 14); } } class Skeleton : Monster { public Skeleton() : base(MonsterType.Skeleton) { type = MonsterType.Skeleton; SetInfo(48, 12); } }
- null
- monster
- C#





