Exemplo n.º 1
0
    public void DefendAllies(NumpadKey numpadKey)
    {
        Character ally = GetAlly(numpadKey);

        if (ally.IsDead())
        {
            audioManager.Play(ally.name + " is-dead");
            return;
        }
        if (ally.moved)
        {
            audioManager.Play(ally.name + " already-has-moved-this-turn");
            return;
        }

        if (CountActiveAllies() >= 2)
        {
            ally.defending = true;
            ally.moved     = ally.isAlly;
            audioManager.Play(ally.name + " will-defend-the-full-party");
            TryEnemiesTurn();
        }
        else
        {
            audioManager.Play("there-is-no-one-to-defend");
        }
    }
Exemplo n.º 2
0
    public void GetToast(NumpadKey numpadKey)
    {
        if (isEmpty(numpadKey))
        {
            audioManager.Play("is-empty");
        }
        else
        {
            switch (numpadKey)
            {
            case NumpadKey.TopKey: audioManager.Play("menu-option"); break;

            case NumpadKey.N1Key: allies[0].GetToast(audioManager, AudioPosition.Left); break;

            case NumpadKey.N2Key: allies[1].GetToast(audioManager, AudioPosition.Center); break;

            case NumpadKey.N3Key: allies[2].GetToast(audioManager, AudioPosition.Right); break;

            case NumpadKey.N5Key: LevelDescription(); break;

            case NumpadKey.N7Key: rooms[0].GetToast(audioManager, AudioPosition.Left); break;

            case NumpadKey.N8Key: rooms[1].GetToast(audioManager, AudioPosition.Center); break;

            case NumpadKey.N9Key: rooms[2].GetToast(audioManager, AudioPosition.Right); break;
            }
        }
    }
Exemplo n.º 3
0
    private bool isEmpty(NumpadKey numpadKey)
    {
        switch (mode)
        {
        case Mode.Battle:
            return(battle.isEmpty(numpadKey));

        case Mode.Path:
            return(path.isEmpty(numpadKey));
        }
        return(false);
    }
Exemplo n.º 4
0
    private Character GetAlly(NumpadKey numpadKey)
    {
        Character ally = null;

        switch (numpadKey)
        {
        case NumpadKey.N1Key: ally = allies[0]; break;

        case NumpadKey.N2Key: ally = allies[1]; break;

        case NumpadKey.N3Key: ally = allies[2]; break;
        }
        return(ally);
    }
Exemplo n.º 5
0
 private void GetToast(NumpadKey numpadKey)
 {
     if (mode == Mode.Battle)
     {
         battle.GetToast(numpadKey);
     }
     if (mode == Mode.Path)
     {
         path.GetToast(numpadKey);
     }
     if (mode == Mode.Menu)
     {
         menu.GetToast(numpadKey);
     }
 }
Exemplo n.º 6
0
    public bool isEmpty(NumpadKey numpadKey)
    {
        switch (numpadKey)
        {
        case NumpadKey.N1Key: return(allies[0] == null);

        case NumpadKey.N2Key: return(allies[1] == null);

        case NumpadKey.N3Key: return(allies[2] == null);

        case NumpadKey.N7Key: return(rooms[0] == null);

        case NumpadKey.N8Key: return(rooms[1] == null);

        case NumpadKey.N9Key: return(rooms[2] == null);
        }
        return(false);
    }
Exemplo n.º 7
0
    private void PressKey(NumpadKey numpadKey)
    {
        if (!keyTypes.ContainsKey(numpadKey))
        {
            return;
        }
        if (isEmpty(numpadKey))
        {
            return;
        }

        GameActions gameAction;

        sequenceKeys.Enqueue(numpadKey);
        sequenceType.Enqueue(keyTypes[numpadKey]);

        bool complete;

        if (IsSequenceValid(out complete, out gameAction))
        {
            keyMap[numpadKey].GetComponent <KeyController>().PressDown(!complete);
        }
        else
        {
            ReleaseAllKeys();   // delete the current sequence
            sequenceKeys.Enqueue(numpadKey);
            sequenceType.Enqueue(keyTypes[numpadKey]);

            bool valid = IsSequenceValid(out complete, out gameAction);
            keyMap[numpadKey].GetComponent <KeyController>().PressDown(valid && !complete);
        }

        if (!complete)
        {
            GetToast(numpadKey);
        }
        if (complete)
        {
            DoAction(gameAction);
            ReleaseAllKeys();
        }
    }
Exemplo n.º 8
0
    public void GetToast(NumpadKey numpadKey)
    {
        switch (numpadKey)
        {
        case NumpadKey.N1Key:
            audioManager.Play("new-game-option");
            break;

        case NumpadKey.N2Key:
            if (previousMode == Mode.Menu)
            {
                audioManager.Play("there-is-no-game-to-resume");
            }
            else
            {
                audioManager.Play("resume", "resume game option");
            }
            break;
        }
    }
Exemplo n.º 9
0
    public void RecoverAlly(NumpadKey numpadKey)
    {
        Character ally = GetAlly(numpadKey);

        if (ally.IsDead())
        {
            audioManager.Play(ally.name + " is-dead");
            return;
        }
        if (ally.moved)
        {
            audioManager.Play(ally.name + " already-has-moved-this-turn");
            return;
        }
        ally.RecoverHealth(Random.Range(5, 11));
        ally.RecoverStamina();
        ally.moved = ally.isAlly;
        audioManager.Play(ally.name + " recovered-some-health-and-stamina");
        TryEnemiesTurn();
    }
Exemplo n.º 10
0
    public void GetToast(NumpadKey numpadKey)
    {
        Character newAllyToasted = null;

        if (isEmpty(numpadKey))
        {
            audioManager.Play("is-empty");
        }
        else
        {
            switch (numpadKey)
            {
            case NumpadKey.TopKey: audioManager.Play("menu-option", "", true); break;

            case NumpadKey.N0Key: audioManager.Play("recovering-option", "", true); break;

            case NumpadKey.N1Key: newAllyToasted = allies[0]; newAllyToasted.GetToast(audioManager, AudioPosition.Left); break;

            case NumpadKey.N2Key: newAllyToasted = allies[1]; newAllyToasted.GetToast(audioManager, AudioPosition.Center); break;

            case NumpadKey.N3Key: newAllyToasted = allies[2]; newAllyToasted.GetToast(audioManager, AudioPosition.Right); break;

            case NumpadKey.N4Key: lastAllyToasted.actions[0].GetToast(audioManager); break;

            case NumpadKey.N5Key: lastAllyToasted.actions[1].GetToast(audioManager); break;

            case NumpadKey.N6Key: lastAllyToasted.actions[2].GetToast(audioManager); break;

            case NumpadKey.N7Key: enemies[0].GetToast(audioManager, AudioPosition.Left); break;

            case NumpadKey.N8Key: enemies[1].GetToast(audioManager, AudioPosition.Center); break;

            case NumpadKey.N9Key: enemies[2].GetToast(audioManager, AudioPosition.Right); break;

            case NumpadKey.Period: audioManager.Play("defense-option", "", true); break;
            }
        }
        lastAllyToasted = newAllyToasted;
    }
Exemplo n.º 11
0
    public bool isEmpty(NumpadKey numpadKey)
    {
        switch (numpadKey)
        {
        case NumpadKey.N1Key: return(allies[0] == null);

        case NumpadKey.N2Key: return(allies[1] == null);

        case NumpadKey.N3Key: return(allies[2] == null);

        case NumpadKey.N4Key: return(lastAllyToasted == null || lastAllyToasted.actions[0] == null);

        case NumpadKey.N5Key: return(lastAllyToasted == null || lastAllyToasted.actions[1] == null);

        case NumpadKey.N6Key: return(lastAllyToasted == null || lastAllyToasted.actions[2] == null);

        case NumpadKey.N7Key: return(enemies[0] == null);

        case NumpadKey.N8Key: return(enemies[1] == null);

        case NumpadKey.N9Key: return(enemies[2] == null);
        }
        return(false);
    }