コード例 #1
0
ファイル: CardGame.cs プロジェクト: adrienbusin/7WondersDuel
 private void OnApplicationFocus(bool hasFocus)
 {
     if (!hasFocus)
     {
         if (_startPosition != transform.position)
         {
             StartCoroutine(StartAnimate());
             transform.localScale = _vector3Original;
             _zonePlayableManager.HideShowZonePlayable(false);
             _cardPlayable = false;
             _dragDropManager.onDropCardAudio();
         }
         GetComponent <CanvasGroup>().blocksRaycasts = true;
         _itemBeingDragged  = null;
         transform.position = _startPosition;
     }
 }
コード例 #2
0
    public void OnDrop(PointerEventData eventData)
    {
        _dragDropManager.onDropCardAudio();
        if (!_cardPlayed && _playerManager.Player.PlayerNumber == wonderPlayer &&
            _wonderManager.NbMerveilleConstruite < 7)
        {
            gameObject.GetComponent <Outline>().effectDistance = new Vector2(0, 0);

            ZonePlayableManager.HideShowZonePlayable(false);
            if (eventData.pointerDrag != null)
            {
                eventData.pointerDrag.GetComponent <CardGame>().ItemBeingDragged = null;
                Card     wonder   = _wonderEffect.getWonderEffect(cardValue);
                CardGame cardGame = eventData.pointerDrag.GetComponent <CardGame>();

                wonder.CardDropNumber = cardGame.CardDropNumber;
                if (_playerManager.Player.AddCarte(wonder))
                {
                    _cardDrop   = eventData.pointerDrag.GetComponent <CardGame>();
                    _cardPlayed = true;
                    cardConstruction.GetComponent <Image>().sprite =
                        eventData.pointerDrag.GetComponent <CardGame>().CardBack;
                    cardConstruction.SetActive(true);
                    _wonderManager.NbMerveilleConstruite++;
                    eventData.pointerDrag.GetComponent <CardGame>().SetCardPlayed();
                }
            }
        }
        if (_wonderManager.NbMerveilleConstruite == 7)
        {
            _cardEffectAge1 = GameObject.FindGameObjectWithTag("CardEffectAge1").GetComponent <CardEffectAge1>();
            List <GameObject> wonders = _cardEffectAge1.GetComponent <CardEffectAge1>().Wonders1;
            foreach (GameObject wonder in wonders)
            {
                if (!wonder.GetComponent <WonderCard>()._cardPlayed)
                {
                    wonder.SetActive(false);
                }
            }
        }
    }
コード例 #3
0
    public void NextPlayerEndAge()
    {
        _zonePlayableManager.HideShowZonePlayable(false);
        if (!PlayerManager.Player.DestroyRessourcePrimaire && !PlayerManager.Player.DestroyRessourceSecondaire)
        {
            var militairePlayer1 = PlayerManager.Player1.Militaire;
            var militairePlayer2 = PlayerManager.Player2.Militaire;

            if (militairePlayer1 > militairePlayer2)
            {
                PlayerManager.Player1.IsPlaying = false;
                PlayerManager.Player2.IsPlaying = true;
                PlayerManager.nextPlayer(0);
            }
            if (militairePlayer2 > militairePlayer1)
            {
                PlayerManager.Player1.IsPlaying = true;
                PlayerManager.Player2.IsPlaying = false;
                PlayerManager.nextPlayer(1);
            }

            if (militairePlayer1 != militairePlayer2)
            {
                return;
            }
            PlayerManager.GetComponent <PlayerManager>().Player.IsPlaying = true;
            PlayerManager.GetComponent <PlayerManager>().Player.PlayerAdverse.IsPlaying = false;
            PlayerManager.nextPlayer(PlayerManager.Player.PlayerAdverse.PlayerNumber);
            PlayerManager.Player.IsSelectedToPlayFirst = true;
            PlayerManager.Player.PlayerAdverse.IsSelectedToPlayFirst = true;
        }
        else
        {
            PlayerManager.Player.IsPlaying = true;
            PlayerManager.Player.PlayerAdverse.IsPlaying = false;
            PlayerManager.nextPlayer(PlayerManager.Player.PlayerAdverse.PlayerNumber);
        }
    }