コード例 #1
0
    public void UseItem(Character target, System.Action <Character, Character, Character[], Character[]> itemFunct)
    {
        List <Character> c_enemy  = (team2_.Contains(CurrentCharacterTurn)) ? team1_ : team2_;
        List <Character> c_allies = (c_enemy == team1_) ? team2_ : team1_;

        List <Character> enemies = new List <Character>();
        List <Character> allies  = new List <Character>();

        foreach (Character c in c_enemy)
        {
            if (c.IsDead)
            {
                continue;
            }
            enemies.Add(c);
        }
        foreach (Character c in c_allies)
        {
            if (c.IsDead)
            {
                continue;
            }
            allies.Add(c);
        }
        itemFunct(CurrentCharacterTurn, target, enemies.ToArray(), allies.ToArray());
        CombatStatusSpeech s = new CombatStatusSpeech(currentCharactersTurn_.name + " used an item!");

        CombatStatusDialogHandler.Instance.ConversationEnd += NextTurnAfterSpeech;
        CombatStatusDialogHandler.Instance.StartConversation(s);
        CombatStatusDialogHandler.Instance.SetButtonInteractions(true);
    }
コード例 #2
0
    private void SpeechFinished(CombatStatusSpeech s)
    {
        Action actionToExecute;

        if (m_speechFinishActions.TryGetValue(s.Text, out actionToExecute))
        {
            actionToExecute();
        }
    }
コード例 #3
0
    public bool StartConversation(CombatStatusSpeech speech)
    {
        Debug.Log("New Combat speech conv");

        //Set the DialogUI to show the first speech.
        SetDialogUI(speech);
        //Set the next speech.
        nextSpeech_ = speech.NextSpeech;

        return(true);
    }
コード例 #4
0
 public void ChangedValue(bool status)
 {
     if (CombatSystem.Instance.CurrentCharacterTurn.Mana < AtackToUse.ResourceCost)
     {
         CombatStatusSpeech s = new CombatStatusSpeech("You dont have enough mana to execute that spell!");
         CombatStatusDialogHandler.Instance.StartConversation(s);
         return;
     }
     if (status && AtackToUse != null)
     {
         cuiHandler.EnableTargetingForAttack(AtackToUse.TargeLimit, AtackToUse);
     }
 }
コード例 #5
0
    public void NextSpeech()
    {
        Debug.Log("Next speech");

        //If there is no more speech then end coversation (clear ui and close it)
        if (nextSpeech_ == null)
        {
            EndConversation();
            return;
        }

        SetDialogUI(nextSpeech_);
        nextSpeech_ = nextSpeech_.NextSpeech;
    }
コード例 #6
0
    private new void Awake()
    {
        //Add the handler again as we are ovveriting start
        base.Awake();

        CombatStatusDialogHandler.Instance.OnSpeechSpoke += SpeechFinished;

        //Set up speech and actions
        //First turn speech
        {
            CombatStatusSpeech SpeechTen = new CombatStatusSpeech("Now try to use an attack on Ceejay!");
            m_speechFinishActions.Add(SpeechTen.Text, HightlighteSpells);
            CombatStatusSpeech SpeechNine    = new CombatStatusSpeech("After you selected the target, press Enter to execute the spell over you target. Keep in mind that some spells don’t need targets and will execute without needed to target.", SpeechTen);
            CombatStatusSpeech EightSpeech   = new CombatStatusSpeech("Depending on the attack, you can target different enemies/allies. To change target use the arrow or W,A,S,D keys on your keyboard.", SpeechNine);
            CombatStatusSpeech SeventhSpeech = new CombatStatusSpeech("Select a Spell from the frame and Hit enter. Then automatically a target will be selected, and an orange arrow will appear over his name.", EightSpeech);
            CombatStatusSpeech SixtSpeech    = new CombatStatusSpeech("The spells button will show you all the spells you got. I already clicked it for you, you should now see all you spells.", SeventhSpeech);
            m_speechFinishActions.Add(SixtSpeech.Text, UnHiglightRun);
            CombatStatusSpeech fifthSpeech = new CombatStatusSpeech("The run button is disabled for this combat, as it is a boss, but in small combats, you can run away from the combat.", SixtSpeech);
            m_speechFinishActions.Add(fifthSpeech.Text, HighlightRun);
            CombatStatusSpeech forthSpeech = new CombatStatusSpeech("What is been highlighted now is the Utility Frame. In here you can use spells, items or run away from the enemy. Let’s explain each part in detail.", fifthSpeech);
            m_speechFinishActions.Add(forthSpeech.Text, HighlightUtilityFrame);
            CombatStatusSpeech thirdSpeech = new CombatStatusSpeech("Each team Frame will have information about each character in the team. The name, level, health and mana.", forthSpeech);
            m_speechFinishActions.Add(thirdSpeech.Text, HighlightEntityFrame);
            CombatStatusSpeech secondSpeech    = new CombatStatusSpeech("What you can see highlighted now are the team frames. The green one is your team and the Red one the enemy team.", thirdSpeech);
            CombatStatusSpeech firstTurnSpeech = new CombatStatusSpeech("Welcome to the Combat Tutorial. In here we will show you show to use the system to win battles! Let’s start by explaining each section of interface.", secondSpeech);
            m_speechFinishActions.Add(firstTurnSpeech.Text, HighlightTeamFrames);
            m_startSpeechPerTurn.Add(firstTurnSpeech);
        }

        //Second turn
        {
            CombatStatusSpeech secondSpeech = new CombatStatusSpeech("So, I just enabled the Items frame and disabled the Spells one. Try to use an item on yourself!");
            m_speechFinishActions.Add(secondSpeech.Text, HighlightItemsDisable);
            CombatStatusSpeech firstSpeech = new CombatStatusSpeech("Now let’s have a look at Items. The items work in same way as the spells, but they will have different effects, like giving you a turn, give you some Mana back ... and more.", secondSpeech);
            m_speechFinishActions.Add(firstSpeech.Text, HighlightItems);
            m_startSpeechPerTurn.Add(firstSpeech);
        }

        //Third turn

        {
            CombatStatusSpeech firstSpeech = new CombatStatusSpeech("From now I will enable everything for you, I will add all the items and spells you currently got to the lists. Try to defeat him!");
            m_speechFinishActions.Add(firstSpeech.Text, TutorialFinished);
            m_startSpeechPerTurn.Add(firstSpeech);
        }

        CombatSystem.Instance.CombatEnd += SwitchToMainMap;
    }
コード例 #7
0
    //Set the DialogUI to have the correct text, images, names etc.
    public void SetDialogUI(CombatStatusSpeech speech)
    {
        if (textUI_)
        {
            textUI_.transform.parent.parent.gameObject.SetActive(true);
        }

        nextAnimator_.SetBool("SpeechFinished", false);
        nextAnimator_.gameObject.SetActive(false);

        gameObject.transform.GetChild(0).GetComponent <Button>().Select();

        ClearDialogUI();
        fullText = speech.Text;

        if (OnSpeechSpoke != null)
        {
            OnSpeechSpoke.Invoke(speech);
        }
    }
コード例 #8
0
    private IEnumerator AttackWithoutMinigame(Attack attack, Character[] targets)
    {
        yield return(new WaitForSeconds(GetComponent <CombatSpriteSetup>().AnimateCharacter(currentCharactersTurn_)));

        attackClipp_.Play();

        List <KeyValuePair <Character, int> > damagesDone = attack.UsedSpell(CurrentCharacterTurn, targets);
        CombatStatusSpeech lastSpeech = null;

        foreach (KeyValuePair <Character, int> charDamaged in damagesDone)
        {
            Debug.Log("Character: " + currentCharactersTurn_ + " attacks " + charDamaged.Key + " for " + charDamaged.Value + "damage.");
            Debug.Log("New Healh of Character: " + charDamaged.Key + charDamaged.Key.Health);
            CombatStatusSpeech s = new CombatStatusSpeech(currentCharactersTurn_.name + " attacks " + charDamaged.Key.name + " for " + charDamaged.Value + " damage.", lastSpeech);
            lastSpeech = s;
        }
        CombatStatusDialogHandler.Instance.ConversationEnd += NextTurnAfterSpeech;
        CombatStatusDialogHandler.Instance.StartConversation(lastSpeech);
        CombatStatusDialogHandler.Instance.SetButtonInteractions(true);
    }
コード例 #9
0
    private IEnumerator AttackCharacterAfterMinigame(Attack attack, Character[] targets)
    {
        if (!mgh_ || !mgh_.CurrentMiniGame)
        {
            yield return(null);
        }

        while (!mgh_.CurrentMiniGame.Finished)
        {
            yield return(null);
        }

        MiniGame.GameOutcome outcome = mgh_.CurrentMiniGame.Outcome;
        float score = mgh_.CurrentMiniGame.Score;

        yield return(new WaitForSeconds(GetComponent <CombatSpriteSetup>().AnimateCharacter(currentCharactersTurn_)));

        attackClipp_.Play();

        List <KeyValuePair <Character, int> > damagesDone = attack.UsedSpell(CurrentCharacterTurn, targets, score);

        CombatStatusSpeech lastSpeech = null;

        foreach (KeyValuePair <Character, int> charDamaged in damagesDone)
        {
            Debug.Log("Character: " + currentCharactersTurn_ + " attacks " + charDamaged.Key + " for " + charDamaged.Value + "damage.");
            Debug.Log("New Healh of Character: " + charDamaged.Key + charDamaged.Key.Health);
            CombatStatusSpeech s = new CombatStatusSpeech(currentCharactersTurn_.name + " attacks " + charDamaged.Key.name + " for " + charDamaged.Value + " damage.", lastSpeech);
            lastSpeech = s;
        }
        CombatStatusDialogHandler.Instance.ConversationEnd += NextTurnAfterSpeech;
        CombatStatusDialogHandler.Instance.StartConversation(lastSpeech);
        CombatStatusDialogHandler.Instance.SetButtonInteractions(true);

        mgh_.CurrentMiniGame.SetToNotNeeded();
        yield break;
    }
コード例 #10
0
    private CombatStatusSpeech nextSpeech_ = null; //The next speech after this one. (null means end of conversation.)

    public CombatStatusSpeech(string textForSpeech, CombatStatusSpeech nextspeech = null)
    {
        text_       = textForSpeech;
        nextSpeech_ = nextspeech;
    }