コード例 #1
0
 public void Attack(ActionStruct action, BoardController boardController)
 {
     if (action.type == ActionType.melee)
     {
         Debug.Log($"{_tokken.posOnBoardX}, {_tokken.posOnBoardY}, {action.direction}, {_tokken.faction}");
         Tokken target = boardController.CheckForFirstTargetInLine(_tokken.posOnBoardX, _tokken.posOnBoardY, action.direction, 1, _tokken.faction);
         if (target != null)
         {
             Debug.Log($"Atakujo");
             Debug.Log($"{target.name}");
             target.GetComponent <IDamage>().TakeDamage(action.damage);
         }
         else
         {
             Debug.Log("Brak targetu");
         }
     }
     if (action.type == ActionType.ranged)
     {
         Tokken target = boardController.CheckForFirstTargetInLine(_tokken.posOnBoardX, _tokken.posOnBoardY, action.direction, 5, _tokken.faction);
         if (target != null)
         {
             target.GetComponent <IDamage>().TakeDamage(action.damage);
         }
     }
 }
コード例 #2
0
    public Tokken CheckForFirstTargetInLine(int attackerPosX, int attackerPosY, int attackDirection, int attackDistance, Faction myFaction)
    {
        bool   noTarget  = true;
        Tokken target    = null;
        Hex    currenHex = hexBoard[attackerPosX][attackerPosY];

        Debug.Log($"HEX:{hexBoard[1][1].GetNeighbour(5).name}");

        while (noTarget)
        {
            if (currenHex.GetNeighbour(attackDirection) != null)
            {
                Hex neighbour = currenHex.GetNeighbour(attackDirection);
                Debug.Log(neighbour.name);
                currenHex = neighbour;
                if (neighbour.isOccupied)
                {
                    if (neighbour.ReturnTokken().faction != myFaction)
                    {
                        target   = neighbour.ReturnTokken();
                        noTarget = false;
                    }
                }
            }
            else
            {
                break;
            }
        }

        return(target);
    }
コード例 #3
0
 public void Shuffle(ref Deck deck)
 {
     System.Random random   = new System.Random();
     Tokken[]      _tokkens = deck.tokkens;
     for (int i = 0; i < _tokkens.Length; i++)
     {
         int    j    = random.Next(i, _tokkens.Length);
         Tokken temp = _tokkens[i];
         _tokkens[i] = _tokkens[j];
         _tokkens[j] = temp;
     }
     deck.tokkens = _tokkens;
 }
コード例 #4
0
    public List <Tokken> FindsTokkensWithHaste(int haste)
    {
        List <Tokken> tokkensWithHaste = new List <Tokken>();

        for (int i = 0; i < board.Length; i++)
        {
            for (int j = 0; j < board[i].Length; j++)
            {
                Tokken tokken = board[i][j].ReturnTokken();
                if (tokken != null)
                {
                    for (int k = 0; k < tokken.initiative.Length; k++)
                    {
                        if (tokken.initiative[k] == haste)
                        {
                            tokkensWithHaste.Add(tokken);
                        }
                    }
                }
            }
        }
        return(tokkensWithHaste);
    }
コード例 #5
0
 public TokkenAction(Tokken tokken)
 {
     _tokken = tokken;
     actions = _tokken.action;
 }
コード例 #6
0
 private void Awake()
 {
     tokken = GetComponent <Tokken>();
 }
コード例 #7
0
 private void Awake()
 {
     tokken = GetComponent <Tokken>();
     camera = Camera.main;
 }