Beispiel #1
0
 public IEnumerator ShowEaterMenuRoutine(Unit dropper)
 {
     eaterSelector.gameObject.SetActive(true);
     eaterView.Populate(Global.Instance().Party, (obj, unit) => {
         obj.GetComponent <EaterCell>().Populate(unit, MonsterFamily.GetTransformResult(unit, dropper));
     });
     eaterSelector.gameObject.SetActive(true);
     yield return(null);
 }
Beispiel #2
0
    private async Task <bool> DoMeatAsync()
    {
        var roll   = UnityEngine.Random.Range(0, 100);
        var offset = 0;

        if (Enemy.Size > 1)
        {
            offset = UnityEngine.Random.Range(0, Enemy.Size);
        }
        Unit dropper = null;

        for (var i = 0; i < Enemy.Groups.Count; i += 1)
        {
            var index = (i + offset) % Enemy.Groups.Count;
            if (roll < Enemy[index].MeatDropChance)
            {
                dropper = Enemy[index];
                break;
            }
        }
        if (dropper == null)
        {
            return(false);
        }

        await WriteLineAsync("");
        await WriteLineAsync("");
        await WriteLineAsync("Found meat of " + dropper.Name + ".");

        await View.ShowEatYesNoMenuRoutine();

        var command = await View.eatYesNoSelector.SelectCommandAsync();

        await View.HideEatYesNoRoutine();

        if (command != "EAT")
        {
            return(false);
        }

        await View.ShowEaterMenuRoutine(dropper);

        var selection = await View.eaterSelector.SelectItemAsync();

        await View.HideEaterMenuRoutine();

        if (selection < 0)
        {
            return(false);
        }

        var eater = Player[selection];

        if (eater == null)
        {
            return(false);
        }

        CharaData newForm = MonsterFamily.GetTransformResult(eater, dropper);

        if (newForm != null)
        {
            await WriteLineAsync(eater.Name + " transformed into " + newForm.species + ".");

            MonsterFamily.TransformEater(eater, dropper);
        }
        else
        {
            await WriteLineAsync("Nothing happened.");
        }
        await Global.Instance().Input.ConfirmRoutine();

        return(true);
    }