Пример #1
0
    // Use this for initialization
    public override void Start()
    {
        if(ImmunityCombatManager.instance.stage_name.Equals("stomach"))
        {
            level = new StomachLevel();
            background = level.getBackground ();
            mid = level.getMid ();
            foreground = level.getForeground ();
            animation = level.getAnimations();
        }
        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_);

        //make the camera follow the player
        ImmunityCombatManager.instance.camera_.follow (playerContainer);

        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);
    }