private void ProcessOpponentWeaponTargetAction(string shipId, int weaponIndex, string targetId) { // find ship Ship ship = (Ship)FindCardIn(shipId, _game.Opponent.Ships); // TODO - error if ship not active // TODO - error if ship does not have enough weapons (invalid index) // find target IDamageable target = null; if (_game.Player.Deck.Faction.Homeworld.CardId == targetId) { target = _game.Player.Deck.Faction.Homeworld; } else if (target == null) { target = FindCardIn(targetId, _game.Player.Ships); } if (target == null) { target = FindCardIn(targetId, _game.Player.Shipyards); } // TODO - error if target is not valid // if we get here, all ok, set target ship.Weapons[weaponIndex].SetTarget(target); // need to find the handler on the weapon prefab and set the target GameViewController.SetWeaponTarget(ship, weaponIndex, target); }