// Create the fire chain void Start() { // Initialize variables float height = 0.12f; angleBetween = 360 / numChains; float currentY = 0; float currentAngle = 0; for (int j = 0; j < numChains; j++) { // Create the fireballs and place them so they arent relative to the rotation for (int i = 0; i < length; i++) { fireballInstance = Instantiate(fireball) as Fireballs; fireballList.Add(fireballInstance); fireballInstance.transform.position = new Vector2(gameObject.transform.position.x, gameObject.transform.position.y + currentY + spacing + height); currentY = currentY + height + spacing; } // Parent the fireballs to the chain so the fireballs rotate with the chain for (int k = 0; k < fireballList.Count; k++) { fireballList[k].transform.parent = gameObject.transform; } fireballList.Clear(); // Rotate the parent object currentY = 0; currentAngle += angleBetween; transform.eulerAngles = new Vector3(0, 0, currentAngle); } }
public void LoadWorld(string levelName, Game1 game, bool clearMario = true) { var state = (game.Mario == null) ? null : game.Mario.State; game.LevelName = levelName; game.Map = null; game.Mario = null; Items.Clear(); Enemies.Clear(); Fireballs.Clear(); Pipes.Clear(); Background.Clear(); Texts.Clear(); MovingTexts.Clear(); Achievements.Clear(); Game1.Camera.Position = Vector2.Zero; LevelName = levelName; string level = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName) + "\\Content\\Levels\\" + levelName + ".csv"; new LevelLoader(game, level); if (!clearMario) { if (state.Name == "Big") { game.Mario.ToBig(); } else if (state.Name == "Fire") { game.Mario.ToFire(); } } }
public void RemoveFireballs() { foreach (Fireball fireball in fireballRemovalList) { Fireballs.Remove(fireball); } fireballRemovalList.Clear(); }
public void Update(GameTime gametime) { // update scenery with time foreach (IScenery scenery in Sceneries) { scenery.Update(gametime); } // update background blocks for (int i = 0; i < Width; ++i) { for (int j = 0; j < Height; ++j) { IBlock block = Blocks[i].SingleLevel[j]; if (block != null) { block.Update(gametime); } } } foreach (IItem item in Items) { item.Update(gametime); } foreach (IEnemy enemy in Enemies) { enemy.Update(gametime); } foreach (FireHell fireHell in FireHells) { fireHell.Update(gametime); } foreach (IBoss boss in Bosses) { boss.Update(gametime); } foreach (Fireball fireball in Fireballs) { Fireballs.Remove(fireball); fireball.Update(gametime); if (fireball.IsRemove) { RemoveFireballList.Add(fireball); } } foreach (FireShot fireShot in FireShots) { fireShot.Update(gametime); } foreach (ScoreObject score in Scores) { score.Update(gametime); if (score.IsRemoved) { scoresRemoveList.Add(score); } } foreach (FlagStuff flagStuff in FlagStuffs) { flagStuff.Update(gametime); } RemoveFireballs(); RemoveScoreObject(); Mario.Update(gametime); }