示例#1
0
    /// <summary>
    /// フィールドへ召喚
    /// </summary>
    /// <param name="position"></param>
    public void ReturnToDeck(CharacterBase character, Cell fromCell, Deck toDeck)
    {
        bool isExist = DeckCharactersList.Exists(c => c.Index == toDeck.Index);

        //既にそこにキャラクターがいた場合もとのCellに戻す
        if (isExist)
        {
            character.UpdatePositon(fromCell.transform.position);
            character.SetIndex(fromCell.Index);
            character.SetFieldPosition(fromCell.PositionX, fromCell.PositionZ);
            return;
        }

        character.UpdatePositon(toDeck.transform.position, 0f);
        character.SetIndex(toDeck.Index);
        character.ResetFieldPosition();

        SummonCharacterList.Remove(character);
        DeckCharactersList.Add(character);
        character.ChangeState(CharacterBase.POSITION_STATE.DECK);
    }
示例#2
0
    /// <summary>
    /// フィールドへ召喚
    /// </summary>
    /// <param name="position"></param>
    public void Summon(CharacterBase character, Deck fromDeck, Cell fromCell, Cell toCell)
    {
        bool isExist = SummonCharacterList.Exists(c => c.Index == toCell.Index);

        //既にそこにキャラクターがいた場合もとのCellに戻す
        if (isExist)
        {
            if (fromCell != null)
            {
                character.UpdatePositon(fromCell.transform.position);
                character.SetIndex(fromCell.Index);
                character.SetFieldPosition(fromCell.PositionX, fromCell.PositionZ);
            }
            else
            {
                character.UpdatePositon(fromDeck.transform.position, 0f);
                character.SetIndex(fromDeck.Index);
                character.ResetFieldPosition();
            }
            return;
        }

        character.UpdatePositon(toCell.transform.position);
        character.SetIndex(toCell.Index);
        character.SetFieldPosition(toCell.PositionX, toCell.PositionZ);

        //既にフィールドにいたらポジションだけ変更する
        if (character.State == CharacterBase.POSITION_STATE.FIELD)
        {
            return;
        }

        DeckCharactersList.Remove(character);
        SummonCharacterList.Add(character);
        character.ChangeState(CharacterBase.POSITION_STATE.FIELD);
    }