示例#1
0
        public CardShipPair(ShipCard shipCard) :
            base(shipCard)
        {
            Ship       = AddChild(new Ship(shipCard.CardData.ObjectDataAsset));
            CardObject = Ship;

            Debug.Assert(Card is ShipCard);
            ShipCard = Card as ShipCard;
        }
        /// <summary>
        /// Set up the reference to the battle screen and add the card outlines for the ships.
        /// </summary>
        public override void Begin()
        {
            base.Begin();

            BattleScreen = ScreenManager.Instance.GetCurrentScreenAs <BattleScreen>();

            ShipCard       stationCard = Player.GetStationData();
            CardObjectPair stationPair = AddCard(stationCard, WorldPosition, false, false);

            CardOutlines = new CardOutline[ShipCardControl.LocalXPositions.Length];
            for (int i = 0; i < ShipCardControl.LocalXPositions.Length; ++i)
            {
                CardOutlines[i]       = AddChild(new CardOutline(stationPair.Card.Size, ShipCardControl.LocalPosition + new Vector2(ShipCardControl.LocalXPositions[i], 0)), true, true);
                CardOutlines[i].Valid = false;
            }

            BattleScreen.OnCardPlacementStateStarted += ToggleCardOutlines;
            BattleScreen.OnBattleStateStarted        += ToggleCardOutlines;
        }