public bool HandleSingleTouchBegan(FTouch touch)
    {
        if (gameIsOver && !initiatedSceneSwitch)
        {
            FSoundManager.StopMusic();
            initiatedSceneSwitch = true;
            if (goalType == GoalType.GoalOne)
            {
                TMain.SwitchToScene(TMain.SceneType.PeopleSceneGoalOne);
            }
            else if (goalType == GoalType.GoalTwo)
            {
                TMain.SwitchToScene(TMain.SceneType.PeopleSceneGoalTwo);
            }
            else if (goalType == GoalType.GoalThree)
            {
                TMain.SwitchToScene(TMain.SceneType.PeopleSceneGoalThree);
            }
        }

        if (readyToStartOver && !initiatedSceneSwitch)
        {
            initiatedSceneSwitch = true;
            TMain.SwitchToScene(TMain.SceneType.PeopleSceneGoalOne);
        }

        return(true);
    }
 public void ChallangeGameFinshed()
 {
     if (GameControl.Instance.game_data.ChallangePassedNumber > 0)
     {
         SDK.Instance.ReportScore(GameControl.Instance.game_data.ChallangePassedNumber);
     }
     SDK.Instance.FinishLevel("挑战模式结束");
     FSoundManager.StopMusic();
     FSoundManager.PlaySound("Success");
     GameControl.Instance.game_data.isGamePlay = false;
     UIResult.result = false;
     UIManager.Instance.PushShow(UIResult.Info, false);
 }
    public void HandleEnemyHit(float damage)
    {
        enemy_.ChangeHealth((int)(-damage));
        // TODO: Play hit sound
        enemy_.play("hit", true);
        enemy_.curr_behavior_ = EnemyCharacter.BehaviorType.HIT;
        if (enemy_.isDead)
        {
            // TODO: Show win screen
            player_won_ = true;
            enemy_.play("death");

            FSoundManager.StopMusic();
            FSoundManager.PlaySound("player_victory");
            Debug.Log("You win!!");
        }
    }
Beispiel #4
0
    public void HandleEnemyHit(float damage)
    {
        enemy_.ChangeHealth((int)(-damage));
        enemy_.play("hit", true);
        enemy_.curr_behavior_ = EnemyCharacter.BehaviorType.HIT;
        FSoundManager.PlaySound("enemy_hit");
        if (enemy_.isDead)
        {
            finished_time = Time.time;
            player_won_   = true;
            enemy_.play("death");

            FSoundManager.StopMusic();
            FSoundManager.PlaySound("player_victory");
            Debug.Log("You win!!");
        }
    }
Beispiel #5
0
 private void setMusic(FButton button)
 {
     if (DogfighterMain.instance.musicOn == true)
     {
         DogfighterMain.instance.musicOn = false;
         FSoundManager.StopMusic();
         RemoveChild(musicOffLabel);
         AddChild(musicOnLabel);
     }
     else if (DogfighterMain.instance.musicOn == false)
     {
         DogfighterMain.instance.musicOn    = true;
         DogfighterMain.instance.titleMusic = false;
         FSoundManager.PlayMusic("Music/intro", 0.25f);
         RemoveChild(musicOnLabel);
         AddChild(musicOffLabel);
     }
 }
    public void HandlePlayerHit(float damage)
    {
        player_.ChangeHealth((int)(-damage));
        FSoundManager.PlaySound("player_hit");
        ImmunityCombatManager.instance.camera_.shake(100.0f, 0.25f);
        player_.CurrentState = PlayerCharacter.PlayerState.HIT;
        player_.play("hit", true);

        if (player_.isDead)
        {
            player_lost_ = true;
            player_.play("death");

            FSoundManager.StopMusic();
            FSoundManager.PlaySound("player_lose");
            Debug.Log("Game Over!");
        }
    }
Beispiel #7
0
    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));
    }
 public void DoGameOver()
 {
     game_data.isGamePlay = false;
     UnityEngine.Debug.Log("Finished");
     SDK.Instance.FinishLevel(string.Format("完成关卡{0}难度{1}模式{2}", GameControl.Instance.game_data.Current_Difficulty, GameControl.Instance.game_data.currentGameLevel, GameControl.Instance.game_data._current_game_type));
     if (GameControl.Instance.game_data._current_game_type == GameType.Custom)
     {
         FSoundManager.StopMusic();
         int level = GameData.GetPassedLevel(GameControl.Instance.game_data.Current_Difficulty);
         if (GameControl.Instance.game_data.currentGameLevel == level)
         {
             int max_level = GameControl.Instance.game_data.GetLevelDatas(GameControl.Instance.game_data.Current_Difficulty).Count;
             int passed    = level;
             if (max_level > level)
             {
                 passed = level + 1;
             }
             GameData.SetPassedLevel(GameControl.Instance.game_data.Current_Difficulty, passed);
         }
         FSoundManager.PlaySound("Cheers");
         UIResult.result = true;
         UIManager.Instance.PushShow(UIResult.Info, false);
     }
     else
     {
         int max_level = GameData.GetChanllangeLevel();
         if (GameControl.Instance.game_data.ChallangePassedNumber > max_level)
         {
             GameData.SetChallangeLevel(GameControl.Instance.game_data.ChallangePassedNumber);
         }
         FSoundManager.PlaySound("Success");
         GameControl.Instance.game_data.ChallangePassedNumber++;
         GameControl.Instance.game_data.ChallangeRestTime = GameControl.Instance.game_data.ChallangeTime;
         HandleFinishChallangeStop();
         GameControl.Instance.game_data.isGamePlay = false;
         UIResult.result = true;
         UIManager.Instance.PushShow(UIResult.Info, false);
     }
 }
    public void UpdatePostGameOver()
    {
        endGameWaitTimer += Time.fixedDeltaTime;

        if (endGameWaitTimer > 1.0f && Input.anyKeyDown && !initiatedSceneSwitch)
        {
            FSoundManager.StopMusic();
            initiatedSceneSwitch = true;
            if (goalType == GoalType.GoalOne)
            {
                TMain.SwitchToScene(TMain.SceneType.PeopleSceneGoalOne);
            }
            else if (goalType == GoalType.GoalTwo)
            {
                TMain.SwitchToScene(TMain.SceneType.PeopleSceneGoalTwo);
            }
            else if (goalType == GoalType.GoalThree)
            {
                TMain.SwitchToScene(TMain.SceneType.PeopleSceneGoalThree);
            }
        }
    }
Beispiel #10
0
 public void callGameOver()
 {
     GameOver = true;
     AddChild(gameOver);
     FSoundManager.StopMusic();
 }
    // 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);
    }
Beispiel #12
0
 private void OnClickBack(GameObject obj)
 {
     GameControl.Instance.game_data.isGamePlay = false;
     FSoundManager.StopMusic();
     UIManager.Instance.PopShow();
 }
    public void UpdateGoal()
    {
        if (totalDistance < goalDistance - 1000f || initiatedSceneSwitch)
        {
            return;
        }

        if (goalType == GoalType.GoalOne)
        {
            if (faceCoin == null)
            {
                faceCoin   = new FSprite("danaHappy.png");
                faceCoin.x = Futile.screen.width + 100f;
                faceCoin.y = 250f;
                everythingContainer.AddChild(faceCoin);
                everythingContainer.AddChild(whit);                 // move him to top

                Tween tween1 = new Tween(faceCoin, 0.5f, new TweenConfig()
                                         .floatProp("scaleX", -1.0f)
                                         .setEaseType(EaseType.SineInOut));

                Tween tween2 = new Tween(faceCoin, 0.5f, new TweenConfig()
                                         .floatProp("scaleX", 1.0f)
                                         .setEaseType(EaseType.SineInOut));

                TweenChain chain = new TweenChain();
                chain.setIterations(-1);
                chain.append(tween1);
                chain.append(tween2);
                Go.addTween(chain);
                chain.play();
            }

            faceCoin.x += Time.fixedDeltaTime * universalVelocity;

            if (faceCoin.x < 100f)
            {
                initiatedSceneSwitch = true;
                FSoundManager.PlaySound("success");
                TMain.SwitchToScene(TMain.SceneType.DreamSceneOne);
            }
        }

        else if (goalType == GoalType.GoalTwo)
        {
            if (bigHeartCoin == null)
            {
                bigHeartCoin       = new FSprite("heart.psd");
                bigHeartCoin.scale = 2.0f;
                bigHeartCoin.x     = Futile.screen.width + 100f;
                bigHeartCoin.color = new Color(1.0f, 0.2f, 0.2f, 1.0f);
                bigHeartCoin.y     = 250f;
                everythingContainer.AddChild(bigHeartCoin);
                everythingContainer.AddChild(whit);                 // move to top

                Tween tween1 = new Tween(bigHeartCoin, 0.5f, new TweenConfig()
                                         .floatProp("scaleX", -1.0f)
                                         .setEaseType(EaseType.SineInOut));

                Tween tween2 = new Tween(bigHeartCoin, 0.5f, new TweenConfig()
                                         .floatProp("scaleX", 1.0f)
                                         .setEaseType(EaseType.SineInOut));

                TweenChain chain = new TweenChain();
                chain.setIterations(-1);
                chain.append(tween1);
                chain.append(tween2);
                Go.addTween(chain);
                chain.play();
            }

            bigHeartCoin.x += Time.fixedDeltaTime * universalVelocity;

            if (bigHeartCoin.x < 100f)
            {
                initiatedSceneSwitch = true;
                FSoundManager.StopMusic();
                FSoundManager.PlaySound("success");
                TMain.SwitchToScene(TMain.SceneType.DreamSceneTwo);
            }
        }

        else if (goalType == GoalType.GoalThree)
        {
            if (dana == null)
            {
                dana   = new TWalkingCharacter("danaHead.png");
                dana.x = Futile.screen.width + 100f;
                dana.y = 250f;
                everythingContainer.AddChild(dana);
                dana.StartWalking();
            }

            dana.x += Time.fixedDeltaTime * universalVelocity * 0.25f;

            if (dana.x < 350f)
            {
                start.isVisible = goal.isVisible = false;
                FSoundManager.PlayMusic("yay");
                foundEachother = true;
                dana.TurnAround();
                dana.StopWalking();
                whit.StopWalking();
                parallaxScene.StopUpdating();
                whit.StopCrouching();
                StartHeartShower();
            }
        }
    }
    public void EndGame()
    {
        FlyOutUIElements();

        scoreLabel.text = string.Format("{0:#,###0}", score);

        for (int i = hearts.Count - 1; i >= 0; i--)
        {
            FSprite heart = hearts[i];
            foreach (AbstractTween tween in Go.tweensWithTarget(heart))
            {
                Go.removeTween(tween);
            }
            heart.RemoveFromContainer();
            hearts.Remove(heart);
        }

        if (score >= 1000000)
        {
            StartHeartShower();
            FSoundManager.StopMusic();
            FSoundManager.PlaySound("happyPiano");
            gameIsOver = true;
            FLabel label = new FLabel("SoftSugar", "I love you times a million!");
            label.color = new Color(0.12f, 0.12f, 0.12f, 1.0f);
            label.x     = Futile.screen.halfWidth;
            label.y     = Futile.screen.halfHeight;
            label.scale = 0;
            AddChild(label);

            TweenConfig config = new TweenConfig()
                                 .floatProp("scale", 1.0f)
                                 .setEaseType(EaseType.SineInOut)
                                 .onComplete(OnWinLabelDoneAppearing);

            Go.to(label, 0.5f, config);
        }

        if (numHeartsMissed >= 5)
        {
            gameIsOver = true;
            FSoundManager.StopMusic();
            FSoundManager.PlaySound("sadPiano");
            FLabel topLabel    = new FLabel("SoftSugar", "Are you kidding me?!");
            FLabel bottomLabel = new FLabel("SoftSugar", string.Format("I love you way more than x{0:#,###0}!", score));
            topLabel.color    = new Color(0.75f, 0.12f, 0.12f, 1.0f);
            bottomLabel.color = new Color(0.12f, 0.12f, 0.12f, 1.0f);
            bottomLabel.x     = topLabel.x = Futile.screen.halfWidth;
            float bottomBeginning = 300f;
            float segmentHeight   = (Futile.screen.height - bottomBeginning * 2f) / 3f;
            bottomLabel.y     = segmentHeight - bottomLabel.textRect.height / 2f + bottomBeginning;
            topLabel.y        = segmentHeight * 3f - topLabel.textRect.height / 2f + bottomBeginning;
            bottomLabel.scale = topLabel.scale = 0;
            AddChild(topLabel);
            AddChild(bottomLabel);

            TweenConfig config1 = new TweenConfig()
                                  .floatProp("scale", 1.0f)
                                  .setEaseType(EaseType.SineInOut);
            TweenConfig config2 = new TweenConfig()
                                  .floatProp("scale", 0.75f)
                                  .setEaseType(EaseType.SineInOut);

            float duration = 0.5f;

            TweenChain chain = new TweenChain();
            chain.append(new Tween(topLabel, duration, config1));
            chain.append(new Tween(bottomLabel, duration, config2));
            chain.setOnCompleteHandler(OnGameShouldBeFullyOver);

            Go.addTween(chain);
            chain.play();
        }
    }