Ejemplo n.º 1
0
    private void LevelUp(RewardLevel rewardLevel)
    {
        // TODO: animation to show level up along with what power was received.
        print("Level up. " + rewardLevel.reward);

        DialogKey dialogKey = DialogKey.None;

        switch (rewardLevel.reward)
        {
        case RewardType.RewardPushCrates: dialogKey = DialogKey.MoveCrates; break;

        case RewardType.RewardCarryDoubleSouls: dialogKey = DialogKey.MoreSoulCapacity; break;

        case RewardType.RewardMoreTime: dialogKey = DialogKey.MoreTime; break;

        case RewardType.RewardDash: dialogKey = DialogKey.NowCanDash; break;

        case RewardType.RewardEvenMoreTime: dialogKey = DialogKey.EvenMoreTime; break;
        }

        if (dialogKey != DialogKey.None)
        {
            ShowDialog(dialogKey);
        }
    }
Ejemplo n.º 2
0
    public string TextForKey(DialogKey key)
    {
        string text = dialogs[key];

        Assert.IsNotNull(text);
        return(text);
    }
Ejemplo n.º 3
0
 public void ShowDialog(DialogKey key)
 {
     dialogText.text = dialogs.TextForKey(key);
     dialog.SetActive(true);
     showingDialog = true;
     paused        = true;
     plotPoint     = key + 1;
 }
Ejemplo n.º 4
0
 public override void LoadState()
 {
     paused           = false;
     waitingToRestart = false;
     gameOverText.gameObject.SetActive(false);
     plotPoint       = (DialogKey)RestoreInt("plotPoint");
     nextRewardLevel = RestoreInt("nextRewardLevel");
 }
        public GameObject OpenIfNoneOpened(DialogKey key, GameObject obj)
        {
            var dialog = CurrentDialog.FirstOrDefault(o => o.Key == key);

            if (!dialog.Equals(default(DialogItem)))
            {
                return(dialog.Dialog);
            }

            var item = new DialogItem(key, Instantiate(obj, transform));

            CurrentDialog.Push(item);

            return(item.Dialog);
        }
Ejemplo n.º 6
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (!collision.CompareTag("Player"))
        {
            return;
        }

        print("DialogTrigger " + dialogType + "collided with player.");

        DialogKey plotPoint = GameManager.instance.plotPoint;

        if (plotPoint == dialogType)
        {
            print("Show the dialog");
            GameManager.instance.ShowDialog(dialogType);
            Destroy(this.gameObject);
        }
        else
        {
            print("Not time yet to show " + dialogType + ". Plot point is " + plotPoint);
        }
    }
 public DialogItem(DialogKey key, GameObject obj)
 {
     Key    = key;
     Dialog = obj;
 }