Exemple #1
0
    private void EventSink_UnitAttackEvent(UnitAttackEventArgs args)
    {
        List <GamePiece> targets = new List <GamePiece>();

        foreach (GameBoardTile tile in m_GameBoardRelative.CurrentlySelectedTiles)
        {
            if (tile.OccupyingPiece != null)
            {
                targets.Add(tile.OccupyingPiece);
                Debug.LogFormat("Tile Occupant ({0}): {1}",
                                tile.BoardVector, tile.OccupyingPiece.gameObject.name);
            }
        }

        if (m_CurrentFocusPiece.TestMode)
        {
            m_GameBoardRelative.ClearCurrentSelections();
            m_CurrentFocusPiece.FinalizeAttack(targets.ToArray(), args.Tile);
        }

        else if (m_CurrentFocusPiece.UnderLocalControl)
        {
            ClientManager.Instance.SendAttackTargetSyncCommand
                (MatchHandler.CurrentMatch.MatchIdentity, m_CurrentFocusPiece.NetworkIdentity,
                m_CurrentFocusPiece.AttackRating, targets.ToArray(), args.Tile.BoardVector);
        }

        if (m_CurrentFocusPiece.TestMode)
        {
            TurnStateHandler.FinishStep();
        }
    }
Exemple #2
0
 public static void InvokeUnitAttackEvent(UnitAttackEventArgs args)
 {
     UnitAttackEvent?.Invoke(args);
 }