コード例 #1
0
    private IEnumerator OnTurnBegin(APFCharacterController turnBeginChar)
    {
        if (turnBeginChar != null)
        {
            if (turnBeginChar.IsEnemy(TurnCharacter))
            {
                PFTable.CharacterType charType = PFCharacterTable.GetCharacterType(turnBeginChar.CharacterTableId);
                if (charType == PFTable.CharacterType.Player)
                {
                    TurnInfoUI_Player.SetActive(true);
                    yield return(new WaitForSeconds(PFConst.TurnInfoNotiTime));

                    TurnInfoUI_Player.SetActive(false);
                }
                else if (charType == PFTable.CharacterType.Monster)
                {
                    TurnInfoUI_Monster.SetActive(true);
                    yield return(new WaitForSeconds(PFConst.TurnInfoNotiTime));

                    TurnInfoUI_Monster.SetActive(false);
                }
            }

            TurnCharacter = turnBeginChar;

            TurnCharacter.OnTurnBegin();
        }
    }
コード例 #2
0
    public static bool IsEnemy(APFCharacter char1, APFCharacter char2)
    {
        if (char1 != null && 
            char2 != null)
        {
            PFTable.CharacterType charType_char1 = PFCharacterTable.GetCharacterType(char1.CharacterTableId);
            PFTable.CharacterType charType_char2 = PFCharacterTable.GetCharacterType(char2.CharacterTableId);

            bool bResult = (charType_char1 != charType_char2);
            return bResult;
        }

        return false;
    }
コード例 #3
0
    public static APFPlayerController GetPlayerController(List <APFCharacterController> charControllerList)
    {
        if (charControllerList != null)
        {
            for (int i = 0; i < charControllerList.Count; ++i)
            {
                PFTable.CharacterType charType = PFCharacterTable.GetCharacterType(charControllerList[i].CharacterTableId);
                if (charType == PFTable.CharacterType.Player)
                {
                    return(charControllerList[i] as APFPlayerController);
                }
            }
        }

        return(null);
    }
コード例 #4
0
    public List <APFCharacter> GetAliveCharList(PFTable.CharacterType charType)
    {
        List <APFCharacter> aliveList = new List <APFCharacter>();

        for (int i = 0; i < AliveCharCtrlList.Count; ++i)
        {
            APFCharacter          aliveChar     = AliveCharCtrlList[i].GetCharacter();
            PFTable.CharacterType aliveCharType = PFCharacterTable.GetCharacterType(aliveChar.CharacterTableId);

            if (aliveCharType == charType)
            {
                aliveList.Add(aliveChar);
            }
        }

        return(aliveList);
    }
コード例 #5
0
    private void OnUseCard(APFCharacterController srcCharCtrl, PFTable.Card srcCard, APFCharacterController target_clickedChar)
    {
        if (srcCharCtrl != null && srcCard != null)
        {
            EGameResult gameResult = EGameResult.InProgress;

            PFTable.ECardActiveType cardActiveType = PFCardTable.GetCardActiveType(srcCard.uid);
            //if (cardActiveType == PFTable.ECardActiveType.Instant)
            {
                List <APFCharacterController> targetList = GetTargetList(srcCard, target_clickedChar);

                int damage = PFSkill.GetDamage(srcCharCtrl, srcCard.uid);

                for (int i = 0; i < targetList.Count; ++i)
                {
                    targetList[i].OnBeAttacked(damage);

                    srcCharCtrl.OnUseCard_AfterApplyDmg(srcCard, targetList[i]);

                    if (targetList[i].GetHP() <= PFConst.HP_Min)
                    {
                        gameResult = OnCharacterDead(targetList[i]);
                    }
                }
            }



            int[] cardEffectIdList = srcCard.CardEffectIdList;
            if (cardEffectIdList != null)
            {
                for (int i = 0; i < cardEffectIdList.Length; ++i)
                {
                    //PFTable.CardEffect.EType cardEffectType = PFCardEffectTable.GetCardEffectType(cardEffectIdList[i]);
                    //if (cardEffectType == PFTable.CardEffect.EType.DecreaseHP)
                    //{

                    //}

                    int effectId = cardEffectIdList[i];



                    PFTable.Damage effect_Damage = PFTable.GetEffect_Damage(effectId);
                    if (effect_Damage != null)
                    {
                        if (effect_Damage.ActuationTiming == PFTable.EActuationTiming.Instant)
                        {
                            DoDamage(srcCharCtrl, effectId, target_clickedChar);
                            //StartCoroutine(DoDamage(srcCharCtrl, effectId, target_clickedChar));

                            /*
                             * if (targetList[j].GetHP() <= PFConst.HP_Min)
                             * {
                             *  gameResult = OnCharacterDead(targetList[j]);
                             * }
                             */
                        }
                        else
                        {
                            srcCharCtrl.PendingEffect_DamageList.Add(effectId);
                        }
                    }

                    PFTable.AddAtkRate addAtkRate = PFTable.GetAddAtkRate(effectId);
                    if (addAtkRate != null)
                    {
                        //addAtkRate.Amount
                        //addAtkRate.TargetType
                        if (addAtkRate.ActuationTiming == PFTable.EActuationTiming.Instant)
                        {
                        }
                    }



                    PFTable.CardEffect cardEffect = PFTable.GetCardEffect(effectId);
                    if (cardEffect != null)
                    {
                        if (cardEffect.CardEffectType == PFTable.CardEffect.EType.DecreaseHP)
                        {
                            //cardEffect.Amount
                        }
                    }
                }
            }



            if (gameResult == EGameResult.InProgress)
            {
                PFTable.CharacterType srcCharType = PFCharacterTable.GetCharacterType(srcCharCtrl.CharacterTableId);
                if (srcCharType == PFTable.CharacterType.Monster)
                {
                    int remainCost = srcCharCtrl.GetCost();
                    if (remainCost <= 0)
                    {
                        TurnEnd(srcCharCtrl);
                    }
                }
            }
            else if (gameResult == EGameResult.Victory)
            {
                GameOverUI.Title_UILabel.text = PFConst.StrGameResultVictory;
                GameOverUI.gameObject.SetActive(true);
            }
            else if (gameResult == EGameResult.Defeat)
            {
                GameOverUI.Title_UILabel.text = PFConst.StrGameResultDefeat;
                GameOverUI.gameObject.SetActive(true);
            }
        }
    }