Ejemplo n.º 1
0
    void Awake()
    {
        sendButton.OnClickAsObservable().Subscribe(_ =>
        {
            if (!BestScore())
            {
                return;
            }

            SendName(inputField.text);
            SendScore(lastScore, inputField.text);
        });
        exitButton.OnClickAsObservable().Subscribe(_ =>
        {
            blind.enabled = true;
            blind.Play("eyeEffect_UI_blink", 0, 0);
            DOVirtual.DelayedCall(0.5f, () =>
            {
                _IsActive.Value = false;
                gameObject.SetActive(false);
            });
        });
    }
Ejemplo n.º 2
0
    public IObservable <Unit> Attack(Dir8 dir)
    {
        tweensInAttack = new List <Tween>();

        isAttacking        = true;
        currentAttackEnded = new Subject <Unit>();

        tweensInAttack.Add(DOVirtual.DelayedCall(1f, () =>
        {
            tweensInAttack.Add
            (
                rigidBody.DOMove(dir.ToVec2() * attackMoveDistance, 0.5f)
                .SetRelative()
                .SetEase(Ease.Linear)
            );
        }));
        tweensInAttack.Add(DOVirtual.DelayedCall(1.6f, () => attackCollider.enabled = true).ReactsToHeroEye());
        tweensInAttack.Add(DOVirtual.DelayedCall(2.3f, () => attackCollider.enabled = false).ReactsToHeroEye());
        tweensInAttack.Add(DOVirtual.DelayedCall(2.5f, () => currentAttackEnded.OnNext(Unit.Default)).ReactsToHeroEye());
        tweensInAttack.Add(DOVirtual.DelayedCall(3f, () => isAttacking = false).ReactsToHeroEye());

        return(currentAttackEnded);
    }
Ejemplo n.º 3
0
    void DOColorSuccess(Action callback)
    {
        canShoot = false;

        foreach (var s in allSprites)
        {
            s.DOColor(SuccessColor, 0.1f).SetEase(Ease.Linear);
        }

        DOVirtual.DelayedCall(0.3f, () => {
            foreach (var s in allSprites)
            {
                s.DOColor(BackgroundColor, 0.3f).SetEase(Ease.Linear);
            }

            DOVirtual.DelayedCall(0.40f, () => {
                if (callback != null)
                {
                    callback();
                }
            });
        });
    }
Ejemplo n.º 4
0
    void OnCollisionEnter2D(Collision2D col)
    {
        if (started)
        {
            if (col.transform.tag == "Ground")
            {
                DOVirtual.DelayedCall(JumpCooldown, () => {
                    canJump = true;
                });

                string ShakeName = "ShakeJump";
                ProCamera2DShake.Instance.Shake(ShakeName);

                Debug.Log(stockedSpeed);

                //float tmpSpeed;
                SpeedIncrease = DOVirtual.EasedValue(stockedSpeed, stockedSpeed / 12, .25f, Ease.Linear);
                DOVirtual.DelayedCall(.4f, () => {
                    SpeedIncrease = DOVirtual.EasedValue(stockedSpeed, stockedSpeed, .15f, Ease.Linear);
                });
            }
        }
    }
Ejemplo n.º 5
0
    void MoveToGame()
    {
        StopAllCoroutines();
        isDishMove = false;

        gameObj.SetActive(true);

        Vector2 defaultLeftPosition  = leftObj.transform.localPosition;
        Vector2 defaultRightPosition = rightObj.transform.localPosition;


        leftObj.transform.DOMoveX(-10f, 0.5f).OnComplete(() =>
        {
            leftObj.SetActive(false);
            leftObj.transform.localPosition = defaultLeftPosition;
        });


        rightObj.transform.DOMoveX(10f, 0.5f).OnComplete(() =>
        {
            rightObj.SetActive(false);
            rightObj.transform.localPosition = defaultRightPosition;
        });

        SoundManager.instance.source.Stop();


        DOVirtual.DelayedCall(0.5f, () =>
        {
            titleObj.transform.DOLocalMoveX(-1334f, 0.5f);
            gameObj.transform.DOMove(new Vector3(0f, 0f, 0f), 0.5f).OnComplete(() =>
            {
                titleObj.SetActive(false);
                StartCoroutine(StartCountDown());
            });;
        });
    }
Ejemplo n.º 6
0
    public void Execute(List <Monster> activeMonsters, AbilityInfo.Info info, int level)
    {
        if (IsCooldown)
        {
            return;
        }
        else
        {
            IsCooldown = true;
            DOVirtual.DelayedCall(info.cooldown, () => IsCooldown = false);
        }

        var gObj = Object.Instantiate(effect, new Vector3(0F, -0.8F), Quaternion.identity);

        gObj.transform.localScale = new Vector3(info.hitCount * 1.5F, info.hitCount * 1.5F);
        Object.Destroy(gObj, info.duration);
        Debug.Log("생성");

        foreach (var monster in activeMonsters)
        {
            switch (monster.Aura)
            {
            case Aura.None:
            case Aura.Lightning:
            case Aura.Wind:
            case Aura.Flame:
            case Aura.Ice when monster.AuraLevel <= level:
                EarthSkill(monster, info, level);
                break;

            case Aura.Earth:
                monster.SetSpeedFor(0F, 0.5F);
                DOVirtual.DelayedCall(0.5F, () => EarthSkill(monster, info, level));
                break;
            }
        }
    }
Ejemplo n.º 7
0
        protected override void OnStart()
        {
            m_animator     = GetComponent <Animator>();
            scream         = Animator.StringToHash("Scream");
            basicAttack    = Animator.StringToHash("Basic Attack");
            clawAttack     = Animator.StringToHash("Claw Attack");
            flameAttack    = Animator.StringToHash("Flame Attack");
            defend         = Animator.StringToHash("Defend");
            getHit         = Animator.StringToHash("Get Hit");
            sleep          = Animator.StringToHash("Sleep");
            walk           = Animator.StringToHash("Walk");
            run            = Animator.StringToHash("Run");
            takeOff        = Animator.StringToHash("Take Off");
            flyFlameAttack = Animator.StringToHash("Fly Flame Attack");
            flyForward     = Animator.StringToHash("Fly Forward");
            flyGlide       = Animator.StringToHash("Fly Glide");
            land           = Animator.StringToHash("Land");
            die            = Animator.StringToHash("Die");
            idle02         = Animator.StringToHash("Idle02");

            m_core.m_isStart.Where(_ => _).Subscribe(_ => TakeOff()).AddTo(gameObject);

            m_core.m_damge.Where(_ => _ > 0f).Subscribe(_ =>
            {
                GetHit();
                DOVirtual.DelayedCall(.2f, () => TakeOff());
            }).AddTo(gameObject);

            m_core.m_attack.Where(_ => _ > 0f).Subscribe(_ => { FlyFlameAttack(); });

            m_core.m_PlayerCore.m_isJudge.Where(_ => _ == 3).Subscribe(_ =>
            {
                Die();
                DOVirtual.DelayedCall(1f, () => m_core.m_PlayerCore.m_isJudge.Value = 4);
                DOVirtual.DelayedCall(1.1f, () => Destroy(this.gameObject));
            }).AddTo(gameObject);
        }
Ejemplo n.º 8
0
    /// <summary>
    /// 单击选择一个格子,高亮可消除的所有格子,1秒后取消选中状态
    /// 双击一个格子,触发消除相连的同颜色格子
    /// </summary>
    /// <param name="cube"></param>
    void OnClickStar(GameObject cube)
    {
        if (starMap.selectedStar && starMap.selectedStar == cube)
        { //double click
            PreprocessPopStar();
            return;
        }
        if (starMap.selectedStar)
        {
            CancelSelectImmediately();
        }
        starMap.selectedStar = cube;
        starMap.SearchStarChunk();

        if (starMap.eliminableList.Count > 1)
        {
            predictPoint = (int)(5 * Mathf.Pow(starMap.eliminableList.Count, 2));
            UpdateText();
        }
        //Debug.Log("可消除星星个数:" + starMap.eliminableList.Count + ", 分数:" + predictPoint);
        starMap.LightEliminableStar();
        // Invoke("CancelSelect", 1);   // 处于性能的角度,不使用
        DOVirtual.DelayedCall(1, CancelSelect);
    }
Ejemplo n.º 9
0
    IEnumerator SpawnExistingPlayerRandom(GameObject player, float timeBeforeSpawn = 0, bool waveAtSpawn = false)
    {
        Vector3 newPos    = new Vector3();
        int     loopCount = 0;

        player.SetActive(false);

        yield return(new WaitForSeconds(timeBeforeSpawn));

        do
        {
            loopCount++;
            newPos = new Vector3(Random.Range(xLimits.x + playerLimitReduction, xLimits.y - playerLimitReduction), player.transform.position.y, Random.Range(zLimits.x + playerLimitReduction, zLimits.y - playerLimitReduction));
            yield return(null);
        }while(Physics.CheckSphere(newPos, checkSphereRadius, gameplayLayer) && loopCount < maxWhileLoop);

        player.layer = LayerMask.NameToLayer("Safe");
        player.GetComponent <Rigidbody>().velocity        = Vector3.zero;
        player.GetComponent <Rigidbody>().angularVelocity = Vector3.zero;

        player.SetActive(true);
        player.transform.position = newPos;

        DOVirtual.DelayedCall(safeDuration, () =>
        {
            player.GetComponent <PlayersGameplay>().OnSafeEndVoid();
            player.layer = LayerMask.NameToLayer("Player");
        }).SetUpdate(false);

        //SpawnParticles (player);

        if (waveAtSpawn)
        {
            player.GetComponent <PlayersFXAnimations>().WaveFX(true);
        }
    }
Ejemplo n.º 10
0
    //ステージクリア
    void OnStageClear(bool isPerfect)
    {
        this.soundManager.playBGM("bgm_clear", 0.5f, false);
        this.sceneCanvas.SendMessage("OnStageClear", isPerfect);
        this.app.playingStageNumber++;

        //全ステージクリア判定
        if (this.app.playingStageNumber > this.app.maxStageNumber)
        {
            DOVirtual.DelayedCall(7.0f, () => {
                this.soundManager.playBGM("bgm_allclear", 1.0f, false);
                this.sceneCanvas.SendMessage("OnAllClear");
            });
        }
        else
        {
            //次のステージ構築
            DOVirtual.DelayedCall(7.0f, () => {
                Destroy(this.sceneView);
                Destroy(this.sceneCanvas);
                this.setupScene();
            });
        }
    }
Ejemplo n.º 11
0
    private void SceneChangeOut()
    {
        float timeDelay = 0.5f;

        GameObject[]    changer  = new GameObject[4];
        RectTransform[] rectTran = new RectTransform[4];

        for (int i = 0; i < 4; i++)
        {
            changer[i]  = SceneChangeEnd.transform.Find(i.ToString()).gameObject;
            rectTran[i] = changer[i].GetComponent <RectTransform>();
        }
        changer[0].transform.parent.gameObject.SetActive(true);

        DontDestroyOnLoad(SceneChangeEnd);

        Sequence sceneChangeTween = DOTween.Sequence();

        for (int i = 0; i < 4; i++)
        {
            changer[i].SetActive(true);
            sceneChangeTween.Insert(1 + 0.25f * i,
                                    rectTran[i].DOLocalMoveX(0, timeDelay).SetEase(Ease.OutQuint)
                                    );
        }

        sceneChangeTween.Join(
            DOVirtual.DelayedCall(3f, () =>
        {
            DataHolder.TemporaryGameObject = SceneChangeEnd;
            SceneManager.LoadScene("Music Select");
        })
            );

        sceneChangeTween.Play();
    }
Ejemplo n.º 12
0
        private void Emit()
        {
            _lefWing.DOLocalRotate(new Vector3(0, 0, -15), 0.5f);
            _righWing.DOLocalRotate(new Vector3(0, 0, 15), 0.5f).OnComplete(() =>
            {
                _leftEffect.SetActive(false);
                _rightEffect.SetActive(false);

                var obj = BulletPools.Instance.Spawn("ViceBullet_7");
                obj.GetComponent <ViceBullet7>().Initi(Random.Range(17000f, 18000f));
                obj.transform.position   = _shootPos.position;
                obj.transform.localScale = Vector3.zero;
            });

            DOVirtual.DelayedCall(0.8f, () =>
            {
                _lefWing.DOLocalRotate(new Vector3(0, 0, 0), 0.5f);
                _righWing.DOLocalRotate(new Vector3(0, 0, 0), 0.5f).OnComplete(() =>
                {
                    _leftEffect.SetActive(true);
                    _rightEffect.SetActive(true);
                });
            });
        }
Ejemplo n.º 13
0
        public void Calibrate(string step, float time, Action startCallback = null, Action updateCallback = null, Action endCallback = null)
        {
            // TODO: put this mess inside of a coroutine or a sequence

            mainTitleGroup.DOFade(1, .5f).SetEase(Ease.InCubic);
            subtitleGroup.DOFade(1, .5f).SetEase(Ease.InCubic);
            currentStepGroup.DOFade(1, .5f).SetDelay(0.1f).SetEase(Ease.InCubic);
            currentStep.text = step;

            DOVirtual.DelayedCall(.5f, () =>
            {
                CountDownAnimation(number3, () => CountDownAnimation(number2, () => CountDownAnimation(number1, () =>
                {
                    startCallback?.Invoke();

                    timeCanvas.DOFade(1, 0.5f).SetEase(Ease.InCubic).OnComplete(() => { timeCanvas.DOFade(0, 0.5f).SetDelay(time - 0.5f).SetEase(Ease.OutCubic); });
                    subtitleGroup.DOFade(0, .5f).SetEase(Ease.OutCubic);
                    timeTitleGroup.DOFade(1, 0.5f).SetEase(Ease.OutCubic);
                    //Animator.setTrigger("Trigger name")

                    DOVirtual.Float(0, 1, time,
                                    value =>
                    {
                        updateCallback?.Invoke();
                        timer.value = value;
                    }).SetEase(Ease.Linear).OnComplete(
                        () =>
                    {
                        endCallback?.Invoke();

                        mainTitleGroup.DOFade(0, .5f).SetEase(Ease.OutCubic);
                        currentStepGroup.DOFade(0, .5f).SetDelay(0.1f).SetEase(Ease.OutCubic);
                    });
                })));
            });
        }
Ejemplo n.º 14
0
    protected void ChangeFade()
    {
        if (image == null && sprite == null)
        {
            return;
        }
        float target = isUI ? image.color.a : sprite.color.a;

        if (isFrom)
        {
            if (isUI)
            {
                image.DOFade(alphaTarget, 0f);
            }
            else
            {
                sprite.DOFade(alphaTarget, 0f);
            }
        }
        else
        {
            target = alphaTarget;
        }

        DOVirtual.DelayedCall(delay, () =>
        {
            if (isUI)
            {
                image.DOFade(target, duration).SetEase(alphaMoveMode);
            }
            else
            {
                sprite.DOFade(target, duration).SetEase(alphaMoveMode);
            }
        }, ignoreTimescale);
    }
Ejemplo n.º 15
0
 public void StartSlowMo()
 {
     SlowMotion.transform.DOLocalMove(new Vector2(930, -510), .05f);
     CircleFeel.transform.DOScale(1, 0);
     CircleFeel.DOColor(Color.white, 0);
     SlowMotion.DOFade(0, .05f);
     DOVirtual.DelayedCall(.1f, () => {
         SlowMotion.DOFade(.75f, .1f);
         SlowMotion.transform.DOScale(4, 0f);
         CircleFeel.transform.DOScale(25, .25f);
         CircleFeel.DOFade(.75f, .15f).OnComplete(() => {
             CircleFeel.DOFade(0, .1f);
         });
         SlowMotion.transform.DOPunchPosition(Vector3.one * 30f, .15f, 18, 1).OnComplete(() => {
             SlowMotion.transform.DOLocalMove(new Vector2(0, 0), .05f);
             SlowMotion.DOFade(0, .05f);
             DOVirtual.DelayedCall(.2f, () =>
             {
                 SlowMotion.DOFade(1, .15f);
                 SlowMotion.transform.DOScale(1, 0f);
             });
         });
     });
 }
Ejemplo n.º 16
0
    private void ShowResult(float x)
    {
        // 回転終了
        isPlaying = false;
        // 指定範囲内にあるチーム名・発表者を取得
        for (int i = 1; i <= rouletteMaker.PRESENTER_LIST.Count; i++)
        {
            if (((rotatePerRoulette * (i - 1) <= x) && x <= (rotatePerRoulette * i)) ||
                (-(360 - ((i - 1) * rotatePerRoulette)) >= x && x >= -(360 - (i * rotatePerRoulette))))
            {
                resultTeam      = rouletteMaker.BOARD_LIST[i - 1];
                resultPresenter = rouletteMaker.PRESENTER_LIST[i - 1];
            }
        }
        resultText.text = resultTeam + "チームです!\n" + "発表者は.....";

        // DO Tween の Delay メソッドで意図的に処理遅延
        DOVirtual.DelayedCall(3.0f, () => {
            resultText.text += "\n「" + resultPresenter + "」さん\nです!";

            // リトライボタンの有効化
            retryButton.gameObject.SetActive(true);
        });
    }
Ejemplo n.º 17
0
    public override void HandleNotification(INotification notification)
    {
        switch (notification.Name)
        {
        //注册成功
        case RegisterNotifications.REGISTER_SUCCESS:

            root.GetComponent <RegisterView>().SetSuccessView();
            DOVirtual.DelayedCall(3.0f, () => {
                SceneTools.instance.LoadScene("Login");
            });
            break;

        //注册失败
        case RegisterNotifications.REGISTER_FAILTURE:

            string errorMessage = notification.Body as string;
            root.GetComponent <RegisterView>().ShowError(errorMessage);
            break;

        default:
            break;
        }
    }
Ejemplo n.º 18
0
    public void TryToMove(Vector2 direction)
    {
        _playerControlManager.canPlayerMakeMove = false;
        Vector2 target  = _currentCoord + direction;
        bool    canMove = grid.CanMove(Convert.ToInt32(_currentCoord.x), Convert.ToInt32(_currentCoord.y), Convert.ToInt32(target.x), Convert.ToInt32(target.y));

        if (!canMove)
        {
            IllegalMove(direction);
            return;
        }

        TileData targetTile = grid.GetTileDataFromCoord(Convert.ToInt32(target.x), Convert.ToInt32(target.y));

        Move(direction, target);

        if (targetTile.tileType == TileType.Chocolate)
        {
            DOVirtual.DelayedCall(0.2f, () =>
            {
                _fruit.MakeChocolate();
            }).SetUpdate(false);
        }
    }
Ejemplo n.º 19
0
    public void ShowParticle(string name, Vector3 postion, float timeToHide = -1, System.Action showDoneCB = null)
    {
        if (!particleSystemCache.ContainsKey(name))
        {
            Debug.LogError("There is no particle name : " + name);
            return;
        }

        ParticleSystem particleSystem = particleSystemCache[name][0];

        int currentCursor = cursorPool[name];

        particleSystem = particleSystemCache[name][currentCursor];
        currentCursor++;
        if (currentCursor >= particleSystemCache[name].Count)
        {
            currentCursor = 0;
        }

        particleSystem.gameObject.SetActive(true);
        particleSystem.transform.position = postion;
        particleSystem.Play();

        if (timeToHide > -1)
        {
            DOVirtual.DelayedCall(timeToHide, () =>
            {
                particleSystem.Stop();
                particleSystem.gameObject.SetActive(false);
                if (showDoneCB != null)
                {
                    showDoneCB();
                }
            });
        }
    }
Ejemplo n.º 20
0
    public void OnClickContinueButton()
    {
        // 動画リワード コンティニュー
        Sound.Instans.PlaySe(Sound.Instans.fixSound);
        continueButton.enabled = false;
        TextMeshProUGUI t = continueText.GetComponent <TextMeshProUGUI> ();

        DOTween.ToAlpha(() => t.color, color => t.color = color, 0.3f, 0f);
        DOVirtual.DelayedCall(1.5f, () => {
            if (Advertisement.IsReady("rewardedVideo"))
            {
                var options = new ShowOptions {
                    resultCallback = (ShowResult result) => {
                        AfterContinue();
                    }
                };

                Advertisement.Show("rewardedVideo", options);
            }
            else if (reward.IsLoaded())
            {
                reward.OnAdRewarded += (object sender, Reward e) => {
                    continueSuccess = true;
                };
                reward.OnAdClosed += (object sender, System.EventArgs e) => {
                    admobClose = true;
                    RequestReward();
                };
                reward.Show();
            }
            else
            {
                AfterContinue();
            }
        });
    }
Ejemplo n.º 21
0
    public void UpdateValue()
    {
        float temp = 0;

        seq.Append(DOVirtual.Float(_slider.value,
                                   LocalScore / StepToNext, 0.5f, temp =>
        {
            _slider.value = temp;
        }).OnComplete(delegate
        {
            if (LocalScore / StepToNext >= 1)
            {
                Bonus tempBonus = BonusController.Instance.GetRandomBonus();
                Alerts.AlertCall.CallYesNoAlert(() =>
                {
                    tempBonus.Count++;
                }, () =>
                {
                    tempBonus.Count += 3;
                }, Res.lang.Confirmation[8], tempBonus.MainSprite, tort, Res.lang.WonBonus, Res.lang.Confirmation[9], Res.lang.Confirmation[10]);
                LocalScore = LocalScore - StepToNext;
                _slider.DOValue(LocalScore / StepToNext, 0.5f);
                _slider.value = 0;
                int index     = Random.Range(0, colors.Count);
                _slider.transform.GetChild(1).GetChild(0).GetComponent <Image>().DOColor(UpdateColors(index), 0.3f);
                _slider.transform.GetChild(3).GetComponent <Image>().DOColor(UpdateColors(index), 0.3f);
            }
        }));
        for (int i = 1; i < 6; i++)
        {
            DOVirtual.DelayedCall(i * 0.1f, delegate
            {
                Vibration.Light();
            });
        }
    }
Ejemplo n.º 22
0
    public IObservable <Unit> OnTransitionStart(SceneTransition sceneTransition)
    {
        PostEffectWrapper noise = CameraController.Current?.AfterEffects?.Find("Noise");

        if (noise != null)
        {
            DOTween.To(noise.GetVolume, noise.SetVolume, 0, 2f);
        }

        var end = new Subject <Unit>();

        DOVirtual.DelayedCall(1.2f, () =>
        {
            var windblur = Object.Instantiate(windAndBlur, sceneTransition.transform.parent);
            windblur.OnEnd.Subscribe(ss =>
            {
                scSho = ss;
                end.OnNext(Unit.Default);
            });
            windblur.transform.SetAsLastSibling();
        });

        return(end);
    }
Ejemplo n.º 23
0
 public void OnParticleSystemStopped()
 {
     DOVirtual.DelayedCall(1f, PlayPS);
 }
Ejemplo n.º 24
0
 public void OnPulledFromPool()
 {
     addToPool.Kill();
     addToPool = DOVirtual.DelayedCall(lifeTime, () => GameManager.Instance.bulletPool.Push(this), false);
 }
Ejemplo n.º 25
0
 protected override void OnExit_Attack()
 {
     DOVirtual.DelayedCall(3f, () => missileParent.SetActive(false));
     base.OnExit_Attack();
 }
Ejemplo n.º 26
0
 public void Disable(GameObject gameObject, float delay = 0f)
 {
     DOVirtual.DelayedCall(delay, () => { gameObject.SetActive(false); });
 }
Ejemplo n.º 27
0
    // Update is called once per frame
    //Here goes the gameLoop!
    void Update()
    {
        if (canContinueHistory)
        {
            timerText.gameObject.SetActive(false);
            canContinueHistory   = false;
            delayedHistoryActive = false;
            actualQuestion       = questions [indexQuestion];
            StaticConstants.actualQuestionSpeed = actualQuestion.GetSpeed();
            if (indexQuestion >= 5 && indexQuestion <= 14)
            {
                cameraGlitch.intensity += 0.011f;
            }
            else
            {
                cameraGlitch.intensity = 0;
            }

            indexQuestion++;
            mainText.CleanText();
            mainText.SetNextString(actualQuestion.GetHeader(), actualQuestion.GetBadWord(), () => { canInput = true; timer = 0; });

            int index = 0;

            string nextQuestion = actualQuestion.GetOption(index);

            while (nextQuestion != null)
            {
                index++;
                questionTexts [index].SetNextString(nextQuestion, actualQuestion.GetBadWord());

                nextQuestion = actualQuestion.GetOption(index);
            }
        }

        timer += Time.deltaTime;

        if ((actualQuestion.GetTimeToPass() - timer) < 20)
        {
            if (!timerText.gameObject.activeSelf)
            {
                timerText.gameObject.SetActive(true);
            }
            timerText.text = "TIME TO RESTART: " + ((int)(actualQuestion.GetTimeToPass() - timer)).ToString();
        }
        if (canInput && timer > actualQuestion.GetTimeToPass())
        {
            EndGame();
            timer = 0;
        }
        if (!canContinueHistory && !delayedHistoryActive && (canInput && StaticConstants.numberOfBaddies == 0))
        {
            if (timer > keyStrokeTime)
            {
                if ((Input.GetKeyDown(KeyCode.Keypad0) || Input.GetKeyDown(KeyCode.Alpha0)) && actualQuestion.GetAnswer(0) != null)
                {
                    timer    = 0;
                    canInput = false;

                    if (actualQuestion.GetNumberOfOptions() >= 1)
                    {
                        if (actualQuestion.CanContinue(0))
                        {
                            delayedHistoryActive = true;
                        }
                        else
                        {
                            DOVirtual.DelayedCall(waitTime * 3, EndGame);
                        }
                        mainText.CleanText();
                        mainText.SetNextString(actualQuestion.GetAnswer(0), null, () => { timer = 0; DOVirtual.DelayedCall(waitTime, () => { canContinueHistory = delayedHistoryActive; }); });
                        for (int i = 0; i < questionTexts.Length; i++)
                        {
                            questionTexts [i].CleanText();
                        }
                    }
                }
                else if ((Input.GetKeyDown(KeyCode.Keypad1) || Input.GetKeyDown(KeyCode.Alpha1)) && actualQuestion.GetAnswer(1) != null)
                {
                    timer    = 0;
                    canInput = false;

                    if (actualQuestion.GetNumberOfOptions() >= 2)
                    {
                        if (actualQuestion.CanContinue(1))
                        {
                            delayedHistoryActive = true;
                        }
                        else
                        {
                            DOVirtual.DelayedCall(waitTime * 3, EndGame);
                        }

                        mainText.CleanText();
                        mainText.SetNextString(actualQuestion.GetAnswer(1), null, () => { timer = 0; DOVirtual.DelayedCall(waitTime, () => { canContinueHistory = delayedHistoryActive; }); });
                        for (int i = 0; i < questionTexts.Length; i++)
                        {
                            questionTexts [i].CleanText();
                        }
                    }
                }
                else if ((Input.GetKeyDown(KeyCode.Keypad2) || Input.GetKeyDown(KeyCode.Alpha2)) && actualQuestion.GetAnswer(2) != null)
                {
                    timer    = 0;
                    canInput = false;

                    if (actualQuestion.GetNumberOfOptions() >= 3)
                    {
                        if (actualQuestion.CanContinue(2))
                        {
                            delayedHistoryActive = true;
                        }
                        else
                        {
                            DOVirtual.DelayedCall(waitTime * 3, EndGame);
                        }
                        mainText.CleanText();
                        mainText.SetNextString(actualQuestion.GetAnswer(2), null, () => { timer = 0; DOVirtual.DelayedCall(waitTime, () => { canContinueHistory = delayedHistoryActive; }); });

                        for (int i = 0; i < questionTexts.Length; i++)
                        {
                            questionTexts [i].CleanText();
                        }
                    }
                }
                else if ((Input.GetKeyDown(KeyCode.Keypad3) || Input.GetKeyDown(KeyCode.Alpha3)) && actualQuestion.GetAnswer(3) != null)
                {
                    timer    = 0;
                    canInput = false;

                    if (actualQuestion.GetNumberOfOptions() >= 4)
                    {
                        if (actualQuestion.CanContinue(3))
                        {
                            delayedHistoryActive = true;
                        }
                        else
                        {
                            DOVirtual.DelayedCall(waitTime * 3, EndGame);
                        }
                        mainText.CleanText();
                        mainText.SetNextString(actualQuestion.GetAnswer(3), null, () => { timer = 0; DOVirtual.DelayedCall(waitTime, () => { canContinueHistory = delayedHistoryActive; }); });

                        for (int i = 0; i < questionTexts.Length; i++)
                        {
                            questionTexts [i].CleanText();
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 28
0
 public void ChangeSprite(int key)
 {
     renderer.sprite = sprites[key];
     tween?.Kill();
     tween = DOVirtual.DelayedCall(0.5F, () => renderer.sprite = idleSprite);
 }
Ejemplo n.º 29
0
    //40回目限定
    public bool shrink(int goal)
    {
        ScoreHolder d_score = scriptbox.GetComponent <ScoreHolder>(); //スコアを取得

        SE_container   se = scriptbox.GetComponent <SE_container>();  //スコアを取得
        ImportantValue v0 = scriptbox.GetComponent <ImportantValue>();

        bool hantei = false; //
                             // var lefttri = new Vector3(-0.2166f, -0.125f, -1);
                             //データの引き継ぎ(Lv4状態から)



        shrink_2 s2 = scriptbox.GetComponent <shrink_2>();

        targetpos = s2.targetpos;
        nowpos    = s2.nowpos;
        hazurepos = s2.hazurepos;
        Debug.Log("OK");
        if (goal == targetpos)//正解
        {
            before_edge.SetActive(false);
            after_edge.SetActive(true);

            GetComponent <AudioSource>().PlayOneShot(se.shrink1); //効果音を鳴らす
            hantei = true;                                        //
            d_score.Shrink();


            //※他の三角形(3_tri)はいらない、inactiveにしてよい
            //""""""""""""""""""""""""""""""遅延して消えた方が美しい
            //   triangleup.SetActive(false);
            //   triangleleft.SetActive(false);
            //   triangleright.SetActive(false);
            DOVirtual.DelayedCall(0.1f, () => triangleup.SetActive(false));
            DOVirtual.DelayedCall(0.1f, () => triangleleft.SetActive(false));
            DOVirtual.DelayedCall(0.1f, () => triangleright.SetActive(false));
            //bigbigbigtriamgleが拡大する=元に戻る

            bigrectTran.DOLocalMove(new Vector3(0, 0, -10), 0.1f);//flick3のみ、親も戻る
            bigrectTran.DOScale(1, 0.1f);
            //  rectTran.DOLocalMove(new Vector3(0, 0, -10), 0.1f);


            bool p0pattern = childup.activeSelf;
            bool p1pattern = childleft.activeSelf;
            bool p2pattern = childright.activeSelf;
            bool pxpattern = childnow.activeSelf;

            int yabaiflag = 1;

            int key = (int)(childnow.transform.localPosition.x * 10) + 2;
            //次のプレイヤーの位置(bigbigtriの)場所をじかに求める-2…左 0…上 2…右
            Debug.Log(key + "にいるぞ!!!");
            switch (key) //nowのある場所
                         //	bigbigtriangleがプレイヤー色のままだが、他の子(2_tri)は背景色に戻す
            {
            case 0:      //左
                childright.GetComponent <SpriteRenderer>().material = v0.defomat;
                childleft.GetComponent <SpriteRenderer>().material  = v0.defomat;
                childup.GetComponent <SpriteRenderer>().material    = v0.defomat;
                childright.GetComponent <SpriteRenderer>().sprite   = v0.defospr;
                childleft.GetComponent <SpriteRenderer>().sprite    = v0.defospr;
                childup.GetComponent <SpriteRenderer>().sprite      = v0.defospr;
                childright.GetComponent <SpriteRenderer>().color    = v0.aroundcolor;
                childleft.GetComponent <SpriteRenderer>().color     = v0.aroundcolor;
                childup.GetComponent <SpriteRenderer>().color       = v0.aroundcolor;


                nowpos = 1;

                //p0pattern== pxpatternの判定
                for (int i = 0; i < 1; i++)
                {
                    if (p0pattern != pxpattern)    //2なら
                    {
                        targetpos = 2;
                        hazurepos = 0;
                        yabaiflag = 0;
                        break;
                    }
                    if (p2pattern != pxpattern)    //0なら
                    {
                        targetpos = 0;
                        hazurepos = 2;
                        yabaiflag = 0;
                        break;
                    }
                }
                break;

            case 2:    //上
                childright.GetComponent <SpriteRenderer>().material = v0.defomat;
                childleft.GetComponent <SpriteRenderer>().material  = v0.defomat;
                childup.GetComponent <SpriteRenderer>().material    = v0.defomat;
                childright.GetComponent <SpriteRenderer>().sprite   = v0.defospr;
                childleft.GetComponent <SpriteRenderer>().sprite    = v0.defospr;
                childup.GetComponent <SpriteRenderer>().sprite      = v0.defospr;
                childright.GetComponent <SpriteRenderer>().color    = v0.aroundcolor;
                childleft.GetComponent <SpriteRenderer>().color     = v0.aroundcolor;
                childup.GetComponent <SpriteRenderer>().color       = v0.aroundcolor;


                nowpos = 0;

                for (int i = 0; i < 1; i++)
                {
                    if (p2pattern != pxpattern)    //1なら
                    {
                        targetpos = 1;
                        hazurepos = 2;
                        yabaiflag = 0;
                        break;
                    }
                    if (p1pattern != pxpattern)    //2なら
                    {
                        targetpos = 2;
                        hazurepos = 1;
                        yabaiflag = 0;
                        break;
                    }
                }
                break;

            case 4:    //右
                childright.GetComponent <SpriteRenderer>().material = v0.defomat;
                childleft.GetComponent <SpriteRenderer>().material  = v0.defomat;
                childup.GetComponent <SpriteRenderer>().material    = v0.defomat;
                childright.GetComponent <SpriteRenderer>().sprite   = v0.defospr;
                childleft.GetComponent <SpriteRenderer>().sprite    = v0.defospr;
                childup.GetComponent <SpriteRenderer>().sprite      = v0.defospr;
                childright.GetComponent <SpriteRenderer>().color    = v0.aroundcolor;
                childleft.GetComponent <SpriteRenderer>().color     = v0.aroundcolor;
                childup.GetComponent <SpriteRenderer>().color       = v0.aroundcolor;


                nowpos = 2;

                for (int i = 0; i < 1; i++)
                {
                    if (p1pattern != pxpattern)    //0なら
                    {
                        targetpos = 0;
                        hazurepos = 1;
                        yabaiflag = 0;
                        break;
                    }
                    if (p0pattern != pxpattern)    //1なら
                    {
                        targetpos = 1;
                        hazurepos = 0;
                        yabaiflag = 0;
                        break;
                    }
                }

                break;
            }
            Debug.Log("targetpos =" + targetpos + ",hazurepos =" + hazurepos + "nowpos=" + nowpos);
            if (yabaiflag == 1)
            {
                Debug.Log("えええええええええええええなんでsssssっせえええええええええええええええええええええええええええええ");
            }

            childnow.GetComponent <SpriteRenderer>().color = v0.mycolor;


            // move(goal);
        }
        else
        {
            GetComponent <AudioSource>().PlayOneShot(se.hazure); //効果音を鳴らす
                                                                 //減点
            d_score.Shrinkmiss();
            d_score.left_jiki--;

            var uptri    = new Vector3(0, 0.25f, -5);          //
            var lefttri  = new Vector3(-0.2166f, -0.125f, -5); //
            var righttri = new Vector3(0.2166f, -0.125f, -5);  //
            var sequence = DOTween.Sequence();
            switch (goal)
            {
            case 0:
                switch (nowpos)
                {
                case 0:
                    break;

                case 1:
                    sequence.Append(rectTran.DOLocalMove(uptri, 0.1f));
                    sequence.Append(rectTran.DOLocalMove(lefttri, 0.05f));
                    break;

                case 2:
                    sequence.Append(rectTran.DOLocalMove(uptri, 0.1f));
                    sequence.Append(rectTran.DOLocalMove(righttri, 0.05f));
                    break;
                }
                break;

            case 1:
                switch (nowpos)
                {
                case 0:
                    sequence.Append(rectTran.DOLocalMove(lefttri, 0.1f));
                    sequence.Append(rectTran.DOLocalMove(uptri, 0.05f));
                    break;

                case 1:
                    break;

                case 2:
                    sequence.Append(rectTran.DOLocalMove(lefttri, 0.1f));
                    sequence.Append(rectTran.DOLocalMove(righttri, 0.05f));
                    break;
                }
                break;

            case 2:
                switch (nowpos)
                {
                case 0:
                    sequence.Append(rectTran.DOLocalMove(righttri, 0.1f));
                    sequence.Append(rectTran.DOLocalMove(uptri, 0.05f));
                    break;

                case 1:
                    sequence.Append(rectTran.DOLocalMove(righttri, 0.1f));
                    sequence.Append(rectTran.DOLocalMove(lefttri, 0.05f));
                    break;

                case 2:
                    break;
                }

                break;
            }
        }


        return(hantei); //
    }
Ejemplo n.º 30
0
        void InternalPlay(float delay)
        {
            _ownerBaseX = _owner.x;
            _ownerBaseY = _owner.y;

            _totalTasks = 0;
            int cnt = _items.Count;

            for (int i = 0; i < cnt; i++)
            {
                TransitionItem item = _items[i];
                if (item.targetId.Length > 0)
                {
                    item.target = _owner.GetChildById(item.targetId);
                }
                else
                {
                    item.target = _owner;
                }
                if (item.target == null)
                {
                    continue;
                }

                if (item.tween)
                {
                    float startTime = delay;
                    if (_reversed)
                    {
                        startTime += (_maxTime - item.time - item.duration);
                    }
                    else
                    {
                        startTime += item.time;
                    }
                    item.completed = false;
                    switch (item.type)
                    {
                    case TransitionActionType.XY:
                    case TransitionActionType.Size:
                        _totalTasks++;
                        if (startTime == 0)
                        {
                            StartTween(item);
                        }
                        else
                        {
                            item.tweener = DOVirtual.DelayedCall(startTime, () =>
                            {
                                item.tweener = null;
                                StartTween(item);
                            }, true);
                        }
                        break;

                    case TransitionActionType.Scale:
                    {
                        _totalTasks++;
                        Vector2 endValue;
                        if (_reversed)
                        {
                            item.value.f1 = item.endValue.f1;
                            item.value.f2 = item.endValue.f2;
                            endValue      = new Vector2(item.startValue.f1, item.startValue.f2);
                        }
                        else
                        {
                            item.value.f1 = item.startValue.f1;
                            item.value.f2 = item.startValue.f2;
                            endValue      = new Vector2(item.endValue.f1, item.endValue.f2);
                        }
                        item.tweener = DOTween.To(() => new Vector2(item.value.f1, item.value.f2),
                                                  val =>
                            {
                                item.value.f1 = val.x;
                                item.value.f2 = val.y;
                            }, endValue, item.duration)
                                       .SetEase(item.easeType)
                                       .SetUpdate(true)
                                       .OnStart(() => { if (item.hook != null)
                                                        {
                                                            item.hook();
                                                        }
                                                })
                                       .OnUpdate(() => { ApplyValue(item, item.value); })
                                       .OnComplete(() => { tweenComplete(item); });
                        if (startTime > 0)
                        {
                            item.tweener.SetDelay(startTime);
                        }
                        else
                        {
                            ApplyValue(item, item.value);
                        }
                        if (item.repeat != 0)
                        {
                            item.tweener.SetLoops(item.repeat == -1 ? int.MaxValue : (item.repeat + 1), item.yoyo ? LoopType.Yoyo : LoopType.Restart);
                        }
                        break;
                    }

                    case TransitionActionType.Alpha:
                    {
                        _totalTasks++;
                        float endValue;
                        if (_reversed)
                        {
                            item.value.f1 = item.endValue.f1;
                            endValue      = item.startValue.f1;
                        }
                        else
                        {
                            item.value.f1 = item.startValue.f1;
                            endValue      = item.endValue.f1;
                        }
                        item.tweener = DOTween.To(() => item.value.f1, v => item.value.f1 = v, endValue, item.duration)
                                       .SetEase(item.easeType)
                                       .SetUpdate(true)
                                       .OnStart(() => { if (item.hook != null)
                                                        {
                                                            item.hook();
                                                        }
                                                })
                                       .OnUpdate(() => { ApplyValue(item, item.value); })
                                       .OnComplete(() => { tweenComplete(item); });
                        if (startTime > 0)
                        {
                            item.tweener.SetDelay(startTime);
                        }
                        else
                        {
                            ApplyValue(item, item.value);
                        }
                        if (item.repeat != 0)
                        {
                            item.tweener.SetLoops(item.repeat == -1 ? int.MaxValue : (item.repeat + 1), item.yoyo ? LoopType.Yoyo : LoopType.Restart);
                        }
                        break;
                    }

                    case TransitionActionType.Rotation:
                    {
                        _totalTasks++;
                        int endValue;
                        if (_reversed)
                        {
                            item.value.i = item.endValue.i;
                            endValue     = item.startValue.i;
                        }
                        else
                        {
                            item.value.i = item.startValue.i;
                            endValue     = item.endValue.i;
                        }
                        item.tweener = DOTween.To(() => item.value.i, v => item.value.i = v, endValue, item.duration)
                                       .SetEase(item.easeType)
                                       .SetUpdate(true)
                                       .OnStart(() => { if (item.hook != null)
                                                        {
                                                            item.hook();
                                                        }
                                                })
                                       .OnUpdate(() => { ApplyValue(item, item.value); })
                                       .OnComplete(() => { tweenComplete(item); });
                        if (startTime > 0)
                        {
                            item.tweener.SetDelay(startTime);
                        }
                        else
                        {
                            ApplyValue(item, item.value);
                        }
                        if (item.repeat != 0)
                        {
                            item.tweener.SetLoops(item.repeat == -1 ? int.MaxValue : (item.repeat + 1), item.yoyo ? LoopType.Yoyo : LoopType.Restart);
                        }
                        break;
                    }
                    }
                }
                else
                {
                    float startTime = delay;
                    if (_reversed)
                    {
                        startTime += (_maxTime - item.time);
                    }
                    else
                    {
                        startTime += item.time;
                    }
                    if (startTime == 0)
                    {
                        ApplyValue(item, item.value);
                    }
                    else
                    {
                        item.completed = false;
                        _totalTasks++;
                        item.tweener = DOVirtual.DelayedCall(startTime, () =>
                        {
                            item.tweener   = null;
                            item.completed = true;
                            _totalTasks--;

                            ApplyValue(item, item.value);
                            if (item.hook != null)
                            {
                                item.hook();
                            }

                            CheckAllComplete();
                        }, true);
                    }
                }
            }
        }