Exemplo n.º 1
0
    public override IEnumerator OnSpiritDown(Action action)
    {
        BattleObject.action[player_id] = new PlayerAction(
            Array.IndexOf(BattleObject.GetTeam(player_id).Spirits.ToArray(),
                          BattleObject.GetTeam(player_id).Spirits.First(s => s.CurrentHP > 0))
            , PlayerAction.ActionType.SwitchSpirit);
        yield return(new WaitForEndOfFrame());

        action.Invoke();
    }
    public void OnEnterBattleStart()
    {
        if (BattleObject == null)
        {
            return;
        }
        stateMachine.SetProperty(props.TrainerFight, BattleObject.trainerFight);


        BattleObject.SetSpirit(0, BattleObject.GetTeam(0).Spirits[0]);
        BattleObject.SetSpirit(1, BattleObject.GetTeam(1).Spirits[0]);

        stateMachine.SetProperty(props.PlayerSpirits, BattleObject.GetTeam(0).Spirits.Count);
        stateMachine.SetProperty(props.EnemySpirits, BattleObject.GetTeam(1).Spirits.Count);
        stateMachine.SetProperty(props.StateFinished, true);
    }
Exemplo n.º 3
0
    public void PlayerSelectTeam()
    {
        OverlayView.Instance.ShowOverlay(OverlayView.Overlay.TeamView, (i) => {
            var active_team  = battleObject.GetTeam((int)battleObject.activePlayer).Spirits;
            var active_index = active_team.IndexOf(battleObject.GetSpirit((int)battleObject.activePlayer));

            if (i != active_index)
            {
                if (active_team[i].CurrentHP > 0)
                {
                    action = new PlayerAction(i, PlayerAction.ActionType.SwitchSpirit);
                }
                else
                {
                    Debug.Log("Der Spirit ist Kampfunfähig");
                }
            }
            else
            {
                Debug.Log("Der Spirit ist bereits im Kampf");
            }
        });
    }