コード例 #1
0
    public IEnumerator Deal()
    {
        for (var i = 0; i < xpos.Length; i++)
        {
            var x  = xpos[i];
            var cb = pool[i];

            var cardDetail = factory.Deal();
            cb.ApplyCard(cardDetail);

            var endPos   = new Vector3(x, -112);
            var startPos = new Vector3(x, -224);
            cb.transform.localPosition = startPos;
            var time     = 0f;
            var duration = 0.05f;
            audioSource.PlayOneShot(shhwhh);
            while (time < 1f)
            {
                var currentPos = Vector3.Lerp(startPos, endPos, time);
                time += Time.deltaTime / duration;
                cb.transform.localPosition = currentPos;
                yield return(null);
            }
            cb.transform.localPosition = endPos;
            yield return(new WaitForSeconds(0.5f));
        }

        for (var i = 0; i < xpos.Length; i++)
        {
            var cb = pool[i];
            cb.ShowFront(true);
            audioSource.PlayOneShot(wavs[i]);
            yield return(new WaitForSeconds(0.1f));
        }
    }
コード例 #2
0
 private void PlanetDeck_CardClicked(object sender, PlanetCardClickedEventArgs e)
 {
     if (_state == GameState.PlayerAction)
     {
         _state               = GameState.SetupChooseLifeformCard;
         _planetCard          = e.Details;
         _planetCardBehaviour = e.Card;
         audioSource.PlayOneShot(selectCard);
     }
 }