public void EntityDestroyed(MFEntity entity) { EntityArgs args = new EntityArgs(); args.entity = entity; OnEventEntityDestroyed(this, args); OnEntityDestroyed(entity); }
protected override void OnUpdate() { base.OnUpdate(); if (state == MainGameState.Running) { if (player == null) { player = new MFEntity(this); player.position = new MFVector(0.0f, 0.0f); player.size = new MFVector(0.3f, 0.3f); player.Spawn(); } if (Env.GetKey(Keys.A)) { player.position.x -= 1.0f * Env.deltaTime; } if (Env.GetKey(Keys.D)) { player.position.x += 1.0f * Env.deltaTime; } if (Env.GetKey(Keys.W)) { player.position.y -= 1.0f * Env.deltaTime; } if (Env.GetKey(Keys.S)) { player.position.y += 1.0f * Env.deltaTime; } timer -= Env.deltaTime; if (timer <= 0.0f) { RandomRefreshTime(); SpawnBullet(); } foreach (MFBullet b in listBullet) { b.Move(); } CheckBullets(); CheckHit(); } else if (state == MainGameState.GameOver) { if (Env.GetKeyDown(Keys.Space)) { Restart(); } } }
protected virtual void OnEntityDestroyed(MFEntity entity) { }
protected virtual void OnEntitySpawned(MFEntity entity) { }