public void MMake(int a_nMakedBullet) { for (int i = 0; i < a_nMakedBullet; ++i) { MliPool.Add(new Monster()); } }
public void MonsterClass(AnotherVec2 a_vcDir, float a_fSpeed) { Random MRandom = new Random(); int nMPosX = MRandom.Next(4, 70); //몬스터 X좌표 랜덤 int nMmake = MRandom.Next(0, 3); //몬스터 종류 랜덤 if (MliPool.Count == 0) { MMake(nMAKE_DEFAULT_COUNT); } Monster monster = MliPool[MliPool.Count - 1]; MliPool.RemoveAt(MliPool.Count - 1); monster.Init(nMmake, 6.0F, nMPosX, 0, a_vcDir, a_fSpeed); MliActive.Add(monster); }
public void MonsterUpdate(float a_fDelta) { MliTemp.Clear(); foreach (var val in MliActive) { val.Update(a_fDelta); foreach (var Bval in BliActive) { //몬스터와 플레이어 총알 충돌 //범위 값 이유: rect()의 한쪽 부분을 생각하면 됨 if ((int)val.m_vMPos.x >= (int)Bval.m_vBPos.x - 4 && (int)val.m_vMPos.x <= (int)Bval.m_vBPos.x + 4 && (int)val.m_vMPos.y >= (int)Bval.m_vBPos.y - 3 && (int)val.m_vMPos.y <= (int)Bval.m_vBPos.y + 3) { val.m_fMLife = 0; Bval.m_fBLife = 0; m_nScore += 10; } } if (val.bIsDie == true) { val.RenderClear(); MliTemp.Add(val); } } foreach (var val in MliTemp) { MliActive.Remove(val); MliPool.Add(val); } MliTemp.Clear(); }