コード例 #1
0
    public override IEnumerator OnTurn(Action action)
    {
        BattleObject.action[player_id] = new PlayerAction(
            UnityEngine.Random.Range(0, BattleObject.GetSpirit(player_id).Attacks.Count)
            , PlayerAction.ActionType.Attack);
        yield return(new WaitForEndOfFrame());

        action.Invoke();
    }
コード例 #2
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");
            }
        });
    }
コード例 #3
0
    /* --------------------------------------------------------------- */


    private void SpawnSpirit(int team)
    {
        //Promise p = new Promise();

        var image = team == 0 ? BattleObject.GetSpirit(team).Type.ImageBack : BattleObject.GetSpirit(team).Type.Image;

        BattleObject.GetSpirit(team).CurrentStamina = 0f;

        var hp = team == 0 ? BattleObject.GetSpirit(0).CurrentHP : BattleObject.GetSpirit(1).CurrentHP;

        if (team == 0)
        {
            stateMachine.SetProperty(props.PlayerHP, hp);
        }
        else if (team == 1)
        {
            stateMachine.SetProperty(props.EnemyHP, hp);
        }


        //BattleObject.GetSpirit(team)
        BUI.Instance.Spirits[team].DOFade(0, 0.7f).From()
        .OnStart(() => {
            BUI.Instance.Spirits[team].sprite  = image;
            BUI.Instance.Spirits[team].enabled = true;
            BUI.Instance.SpiritUI[team].SpiritStaminaImage.gameObject.SetActive(true);
        })
        .OnComplete(
            () => {
            stateMachine.SetProperty(props.SpiritsToSpawn,
                                     stateMachine.GetProperty <int>(props.SpiritsToSpawn) - 1);
        });
    }