Esempio n. 1
0
    public void CreateCoinEffect()
    {
        for (int i = 0; i < coinEffectMaxCount; i++)
        {
            CoinEffect coin = Instantiate(coinPrefab, parent);

            coin.gameObject.SetActive(false);

            coinEffectList.Add(coin);
        }
    }
Esempio n. 2
0
    public void Damage(int damage)
    {
        currentHits -= damage;
        if (animator != null)
        {
            animator.SetBool("Hit", true);
        }

        CoinEffect ef = Instantiate(coinEffect).GetComponent <CoinEffect>();

        ef.transform.position = gameObject.transform.position;
        int coins = GlobalVars.getPlayerProfile().GetPlayerCoinMultiplier();

        ef.value = coins;
        GlobalVars.getPlayerProfile().coins += coins;

        if (manager != null)
        {
            manager.AddScore();
        }
    }
Esempio n. 3
0
 //player prefs : Coins - сохраненные монеты
 private void Awake()
 {
     _coinEffect      = FindObjectOfType <CoinEffect>();
     _soundController = FindObjectOfType <SoundController>();
 }
Esempio n. 4
0
    /// <summary>
    /// スロット回転コルチン
    /// </summary>
    private IEnumerator StartSlot()
    {
        var rotationSize = new Vector3(0f, 80f, 0f);

        //停止したリール数
        int stopCount = 0;
        //フレームカウント
        int frameCount = 0;
        //最大フレーム数 = 20フレームで1周
        int maxFrame = this.itemCount * 2;

        //リール毎の停止までの待ち時間
        float[] delay = { 0f, 1f, 1f };

        //全リールが止まるまで
        while (stopCount < this.slotItemObject.Length)
        {
            //1f~0.05f
            float t = 1f - (float)frameCount / maxFrame;

            //リール回転
            for (int i = stopCount; i < this.slotItemObject.Length; i++)
            {
                this.slotItemObject[i].localPosition = this.startPosition * t;
            }

            //停止フラグが立ったとき
            if (this.isStop)
            {
                if (delay[stopCount] > 0f)
                {
                    //待ち
                    delay[stopCount] -= Time.deltaTime;
                }
                else if (frameCount == this.answer[stopCount] * 2)
                {
                    //リールが指定値になったら順にリール停止させる
                    stopCount++;
                    SoundManager.Instance.PlaySe(SeName.SLOT_STOP);
                }
            }

            //フレームカウント増加 0~19
            frameCount = (frameCount + 1) % maxFrame;

            yield return(null);
        }

        //リール回転音停止
        this.slotSeTrack.Stop();

        if (this.response.jackpotHit)
        {
            //スロット当たったならコイン獲得演出表示
            CoinEffect coinEffect = null;

            //1,2段階目
            if (this.jackpotChanceId < 3)
            {
                SoundManager.Instance.PlaySe(SeName.WIN_0);
                coinEffect = Instantiate(this.coinEffectMiddlePrefab, this.transform, false);
            }
            //3段階目
            else
            {
                SoundManager.Instance.PlaySe(SeName.WIN_1);
                coinEffect = Instantiate(this.coinEffectBigPrefab, this.transform, false);
            }

            //獲得コイン数セット
            coinEffect.SetNum(this.response.mMultiJackpotLottery.Where(x => x.itemType == (uint)ItemType.Coin).Sum(x => x.itemNum));

            //コイン獲得演出終了後、1秒経ったらスロット演出終了通知
            coinEffect.onDestroy = () => StartCoroutine(new WaitForSeconds(1f).AddCallback(this.onFinished));
        }
        else
        {
            //スロット外れたので、1秒経ったらスロット演出終了通知
            StartCoroutine(new WaitForSeconds(1f).AddCallback(this.onFinished));
        }
    }