예제 #1
0
    protected override void Execute(List <GameEntity> entities)
    {
        if (contexts.game.gameProgress.state == GameProgressState.InGame)
        {
            foreach (var enemy in entities)
            {
                if (enemy.enemyState.value == EnemyState.Die)
                {
                    //todo 敌人身上应该带分数属性  不同敌人 分数不同
                    var coin = contexts.game.gameCoin.value + 1;
                    contexts.game.ReplaceGameCoin(coin);

                    //敌人死后金币特效
                    CreateIconEffect(enemy.position.value);

                    //金币音效
                    if (coinClip == null)
                    {
                        coinClip = configService.GetAudio("coin");
                    }
                    unityAudioService.PlaySound(coinClip);
                }
            }
        }
        else if (contexts.game.gameProgress.state == GameProgressState.EndGame)
        {
            SavaScore();
            Contexts.sharedInstance.game.ReplaceGameCoin(0);

            // 弹出结算面板
            ModuleManager.Instance.Show(ModuleType.EndGamePad);
        }
    }
예제 #2
0
 protected override void Execute(List <GameEntity> entities)
 {
     audioService.PlaySound(configService.GetAudio("beep_pop"));
     //停止背景音乐
     audioService.StopMusic();
 }