示例#1
0
文件: VisualTests.cs 项目: W3SS/Carty
    private IEnumerator PlayerDrawsCard()
    {
        Text.text = "Player draws a card from deck.";

        GameObject card = GameManager.Instance.CardManager.CreateCard("", false);

        card.transform.position = VisualManager.Instance.DeckPositioning.PositionPlayer(1, 2);
        card.transform.rotation = VisualManager.Instance.DeckPositioning.RotationPlayer(1, 2);

        GameObject card2 = GameManager.Instance.CardManager.CreateCard("", false);

        card2.transform.position = VisualManager.Instance.DeckPositioning.PositionPlayer(0, 2);
        card2.transform.rotation = VisualManager.Instance.DeckPositioning.RotationPlayer(0, 2);

        var wrapper = new VisualCardWrapper(card);

        yield return(StartCoroutine(VisualManager.Instance.HighLevelCardMovement.MoveCardFromDeckToDrawDisplayArea(wrapper)));

        yield return(StartCoroutine(VisualManager.Instance.HighLevelCardMovement.MoveCardFromDisplayAreaToHand(wrapper,
                                                                                                               VisualManager.Instance.HandPositioning.PositionPlayer(0, 1),
                                                                                                               VisualManager.Instance.HandPositioning.RotationPlayer(0, 1))));

        yield return(new WaitForSeconds(5.0f));

        Destroy(card);
        Destroy(card2);
    }
示例#2
0
        private IEnumerator PlayerDrawCardDisplayCo(GameObject card)
        {
            VisualCardWrapper wrapper = new VisualCardWrapper(card);

            yield return(GameManager.Instance.StartCoroutine(VisualManager.Instance.
                                                             HighLevelCardMovement.MoveCardFromDeckToDrawDisplayArea(wrapper)));
        }
示例#3
0
        public IEnumerator MoveCardFromDeckToDrawDisplayArea(VisualCardWrapper card)
        {
            card.CanBeMoved.PauseRotation(0.5f).Flip()
            .Move(VisualManager.Instance.PlayerShowDrawnCardPosition)
            .PauseMovement(1.0f)
            .PauseRotation(1.5f);

            yield return(card.CanBeMoved.WaitUntilMoveReachesThis());
        }
示例#4
0
 void Start()
 {
     HighLighted = false;
     _mouseOver  = GetComponent <CanBeMousedOver>();
     _owned      = GetComponent <CanBeOwned>();
     _move       = GetComponent <CanBeMoved>();
     _hand       = GetComponent <CanBeInHand>();
     _interact   = GetComponent <CanBeInteractedWith>();
     _wrapper    = new VisualCardWrapper(gameObject);
 }
示例#5
0
        private IEnumerator PlayerDrawCardFinishCo(GameObject card)
        {
            VisualCardWrapper wrapper = new VisualCardWrapper(card);

            yield return(GameManager.Instance.StartCoroutine(VisualManager.Instance.
                                                             HighLevelCardMovement.MoveCardFromDisplayAreaToHand(wrapper,
                                                                                                                 GameManager.Instance.PlayerHand.NewCardPosition(),
                                                                                                                 GameManager.Instance.PlayerHand.NewCardRotation()
                                                                                                                 )));

            GameManager.Instance.PlayerHand.Add(wrapper.CanBeInHand);
            if (card.GetComponent <CanBeInteractedWith>())
            {
                card.GetComponent <CanBeInteractedWith>().InteractionAllowed = true;
            }
        }
示例#6
0
        public IEnumerator HighlightCardInHand(VisualCardWrapper card)
        {
            Vector3 previousPosition = card.CardGO.transform.position;
            Vector3 cameraPosition   = Camera.main.transform.position;
            Vector3 direction        = (cameraPosition - previousPosition).normalized;
            float   t = 1.0f / direction.y;
            float   wantedChangeInY = 2.0f;

            Vector3 wantedPosition = previousPosition + wantedChangeInY * t * direction;

            wantedPosition.z = -0.95f;

            card.CanBeDetached.Detached         = true;
            card.CanBeDetached.DetachedPosition = wantedPosition;
            card.CanBeDetached.DetachedRotation = VisualManager.Instance.FlippedOn;

            yield return(null);
        }
示例#7
0
 public IEnumerator UnhighlightCardInHand(VisualCardWrapper card)
 {
     card.CanBeDetached.Detached = false;
     yield return(null);
 }
示例#8
0
 public IEnumerator MoveCardFromDisplayAreaToHand(VisualCardWrapper card, Vector3 wantedPosition, Quaternion wantedRotation)
 {
     card.CanBeMoved.Move(wantedPosition).Rotate(wantedRotation);
     yield return(card.CanBeMoved.WaitUntilMoveReachesThis());
 }