Exemplo n.º 1
0
    /// <summary>
    /// 立ち位置交換
    /// </summary>
    /// <param name="original"></param>
    /// <param name="target"></param>
    public void SwapPosition(CharacterBase original, Deck target)
    {
        int originIndex = original.Index;
        int targetIndex = target.Index;

        original.UpdatePositon(DeckCellList[targetIndex].transform.position);

        CharacterBase swapTarget = DeckCharactersList.FirstOrDefault(chara => chara.Index == targetIndex);

        if (swapTarget != null)
        {
            swapTarget.UpdatePositon(DeckCellList[originIndex].transform.position, 0.2f);
            swapTarget.SetIndex(originIndex);
        }
        original.SetIndex(targetIndex);
    }
Exemplo n.º 2
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);
    }
Exemplo n.º 3
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);
    }