public void clearMe() { background.RemoveAllChildren(); foreground.RemoveAllChildren(); midground.RemoveAllChildren(); enemies.Clear(); humans.Clear(); foreach (FSprite tentacle in tentaclePieces) { tentacle.RemoveFromContainer(); } tentaclePieces.Clear(); foreach (FSprite debug in debugRects.Values) { debug.RemoveFromContainer(); } debugRects.Clear(); }
/* * La actualizacion se llama cada cuadro de actualizacion */ public void Update() { if (!GameOver) { //Key Controllers if (Input.GetKeyDown(KeyCode.LeftArrow)) { leftArrow = true; } if (Input.GetKeyDown(KeyCode.RightArrow)) { rightArrow = true; } if (Input.GetKeyDown(KeyCode.Space)) { jugador.setJump(); } if (Input.GetKeyDown(KeyCode.X)) { jugador.setAttack(); } if (Input.GetKeyDown(KeyCode.DownArrow)) { jugador.getDown(); } if (Input.GetKeyUp(KeyCode.LeftArrow)) { leftArrow = false; } if (Input.GetKeyUp(KeyCode.RightArrow)) { rightArrow = false; } //para evitar llenar de enmigos, solo crearemos uno si se cumple esta condicion if ((_frameCount % 120) == 0) { if (!GameOver) { GenerateMonster(); } } } else { if (Input.GetKeyDown(KeyCode.R)) { for (int x = 0; x < enemies.Count; x++) { if (enemies[x] != null) { enemies[x].Destroy(); } } RemoveChild(_enemyContainer); _enemyContainer = new FContainer(); AddChild(_enemyContainer); Score = 0; GameOver = false; _playerBullets.RemoveAllChildren(); FSoundManager.isMuted = false; FSoundManager.PlayMusic("Barymag"); InitPlayer(); scoreLabel.text = "Score = " + Score; RemoveChild(gameOver); rightArrow = false; leftArrow = false; } } _frameCount++; }