override public void Start() { // Access immunity menu immunityMenu = GameObject.Find("Futile").GetComponent <ImmunityMenu>(); // Sound FSoundManager.StopMusic(); FSoundManager.UnloadAllSoundsAndMusic(); FSoundManager.PlayMusic("background_music"); FSoundManager.PreloadSound("button_click"); // GUI objects background_ = new FSprite("start screen final"); play_button = new FButton("Play", "PlayPressed"); how_to_play_button = new FButton("how_to_play", "how_to_play_pressed"); credits_button = new FButton("Credits", "CreditsPressed"); // Add objects to stage AddChild(background_); AddChild(play_button); AddChild(how_to_play_button); AddChild(credits_button); // Scale and set position background_.scale = 0.0f; play_button.scale = .6f; play_button.x = Futile.screen.halfWidth * .3f; play_button.y = Futile.screen.halfHeight * .1f; how_to_play_button.x = Futile.screen.halfWidth * .45f; how_to_play_button.y = Futile.screen.halfHeight * -.3f; credits_button.scale = .6f; credits_button.x = Futile.screen.halfWidth * .35f; credits_button.y = Futile.screen.halfHeight * -.7f; // Set button delegates play_button.SignalRelease += HandlePlayButton; how_to_play_button.SignalRelease += HandleHowToPlayButton; credits_button.SignalRelease += HandleCreditsButton; Go.to(background_, 0.5f, new TweenConfig().setDelay(0.1f).floatProp("scale", 1.0f).setEaseType(EaseType.BackOut)); }
// Use this for initialization override public void Start() { if (ImmunityCombatManager.instance.stage_name.Equals("stomach")) { level = new StomachLevel(); } else if (ImmunityCombatManager.instance.stage_name.Equals("lung")) { level = new LungLevel(); } else { level = new BrainLevel(); } AddChild(level); FSoundManager.StopMusic(); FSoundManager.UnloadAllSoundsAndMusic(); FSoundManager.PlayMusic("battle_music", .204f); FSprite enemy_headshot = new FSprite("punchy_headshot"); enemy_headshot.x = Futile.screen.halfWidth - enemy_headshot.width / 2.0f - 50.0f; enemy_headshot.y = Futile.screen.halfHeight - enemy_headshot.height / 2.0f - 50.0f; enemy_healthbar_ = new HealthBar(); enemy_healthbar_.scaleX = -.8f; enemy_healthbar_.x = enemy_headshot.x - enemy_headshot.width / 2.0f - 25.0f; enemy_healthbar_.y = enemy_headshot.y; enemy_ = new EnemyCharacter(enemy_healthbar_); if (ImmunityCombatManager.instance.stage_name.Equals("lung") || ImmunityCombatManager.instance.stage_name.Equals("brain")) { enemy_.y = -Futile.screen.halfHeight * .27f; } AddChild(enemy_); FSprite player_headshot = new FSprite("hero_headshot"); player_headshot.scale = .2f; player_headshot.x = -Futile.screen.halfWidth + player_headshot.width / 2.0f + 50.0f; player_headshot.y = Futile.screen.halfHeight - player_headshot.height / 2.0f - 50.0f; player_healthbar = new HealthBar(); player_healthbar.scaleX = .8f; player_healthbar.x = player_headshot.x + player_headshot.width / 2.0f + 25.0f; player_healthbar.y = player_headshot.y; player_ = new PlayerCharacter(player_healthbar); if (ImmunityCombatManager.instance.stage_name.Equals("lung") || ImmunityCombatManager.instance.stage_name.Equals("brain")) { player_.y = -Futile.screen.halfHeight * .5f; } playerContainer = new FContainer(); //Debug.Log ("the player is at " + playerPosition.x + "," + playerPosition.y); playerContainer.AddChild(player_); AddChild(playerContainer); bacteriaContainer_ = new FContainer(); AddChild(bacteriaContainer_); bubbleContainer_ = new FContainer(); AddChild(bubbleContainer_); dyingBacteriaHolder_ = new FContainer(); AddChild(dyingBacteriaHolder_); ImmunityCombatManager.instance.camera_.follow(playerContainer); AddChild(player_headshot); AddChild(player_healthbar); AddChild(enemy_headshot); AddChild(enemy_healthbar_); level_bounding_box = new Rect(-Futile.screen.halfWidth * .9f, Futile.screen.halfHeight * .9f, Futile.screen.halfWidth * 1.8f, Futile.screen.halfHeight * 1.8f); }