コード例 #1
0
    public void BeginBattle(EncounterSet encounter, Sprite backgroundSprite = null, bool playAnimation = false)
    {
        _encounterSet = encounter;
        PlayerController.Instance.PauseGame();

        if (backgroundSprite == null)
        {
            backgroundSprite = GetPlayerGroundSprite();
        }

        battleCanvas = Instantiate(BattleCanvasPrefab).GetComponent <BattleCanvas>();
        battleCanvas.SetupBattleground(backgroundSprite);

        Party   = battleCanvas.SetupParty(PlayerController.Instance.Party);
        Enemies = battleCanvas.SetupMonsters(encounter);
        Party.ForEach((partyMember) => { partyMember.UpdateAnimator(); });

        var bgm = encounter.bgmOverride != null ? encounter.bgmOverride : MapSettings.Instance.BattleBgm;

        MapSettings.Instance.PauseBgm();
        battleCanvas.StartBattleMusic(bgm);

        Battle = Task.Run(BattleLoop, CancelBattle.Token);
    }