Exemplo n.º 1
0
        // a sequence that runs as a coroutine
        IEnumerator TaskSequence(float pressDelay, float fakeDelay)
        {
            if (fakeDelay < pressDelay)
            {
                // wait then show the fake color
                yield return(new WaitForSeconds(fakeDelay));

                rend.material.color = fakeColor;
                currentState        = ReactionState.Fake;

                // wait some more time then show the press color
                yield return(new WaitForSeconds(pressDelay - fakeDelay));

                rend.material.color = pressColor;
                currentState        = ReactionState.Press;
                shownTime           = Time.time;
            }
            else
            {
                // wait then show the real color
                yield return(new WaitForSeconds(fakeDelay));

                rend.material.color = pressColor;
                currentState        = ReactionState.Press;
                shownTime           = Time.time;
            }
        }
Exemplo n.º 2
0
    //public float rotateSpeed=90;

    // Start is called before the first frame update
    void Start()
    {
        reactionState = ReactionState.inital;
        Cylinder.SetActive(false);
        scale.gameObject.SetActive(false);
        beaker.SetActive(false);
    }
        public static ReactionState GetReactionState(Pair <List <string>, List <string> > reaction)
        {
            ReactionState _state = new ReactionState();

            _state = ReactionState.BOTH_KNOWN;

            if (reaction.First.Contains("?"))
            {
                _state = ReactionState.LEFT_UNKNOWN;
            }

            if (reaction.Second.Contains("?"))
            {
                if (_state == ReactionState.LEFT_UNKNOWN)
                {
                    _state = ReactionState.BOTH_UNKNOWN;
                }
                else
                {
                    _state = ReactionState.RIGHT_UNKNOWN;
                }
            }

            return(_state);
        }
Exemplo n.º 4
0
 public void ContinueButtonTwo()
 {
     reactionState = ReactionState.choseMass;
     ContinueCanvasTwo.SetActive(false);
     LiquidCanvas.SetActive(false);
     scale.setNoGrams();
 }
Exemplo n.º 5
0
 public void StartReactionButtonFunction()
 {
     reactionState = ReactionState.reactionStarting;
     MassCanvas.SetActive(false);
     Camera.main.GetComponent <CameraZoomer>().MoveAndZoomToGameObject(beaker.transform); //change this to the beaker's transform
     GetComponent <ReactionAnim>().startAnimation();
 }
Exemplo n.º 6
0
 public void GoBackToLiquid()
 {
     reactionState = ReactionState.choseLiquid;
     Camera.main.GetComponent <CameraZoomer>().MoveAndZoomToGameObject(Cylinder.transform);
     //ContinueCanvasTwo.SetActive(false);
     MassCanvas.SetActive(false);
 }
Exemplo n.º 7
0
 public void ContinueButtonOne()
 {
     reactionState = ReactionState.choseLiquid;
     //Cylinder.GetComponent<GraduatedCylinderScript>().LiquidRenderer.material.SetFloat("_FillAmount", 0);
     liquidAmount  = 0;
     LiquidisReady = false;
 }
Exemplo n.º 8
0
        /// <summary>
        /// Will reset values on this button to be used again
        /// </summary>
        public void ResetValues()
        {
            //Debug.Log("Reset Values called");
            if (audioReady && particlesReady && animationReady && instantiationReady)
            {
                indexOfAnimationList  = animationConditions.animationConditionList.Count - 1;
                indexOfParticleList   = particles.instantiationList.Count - 1;
                indexOfInstantionList = instantiations.instantiationList.Count - 1;

                if (activatedAnimationConditions.Count > 0)
                {
                    foreach (AnimationCondition animationCondition in activatedAnimationConditions)
                    {
                        SingleAnimationToggle(animationCondition);
                    }
                    activatedAnimationConditions.Clear();
                }

                if (reactionState != ReactionState.Finished && !destroySelfAfterUse)
                {
                    reactionState = ReactionState.Ready;
                }
                else if (willDestroy)
                {
                    Destroy(gameObject);;
                }
            }
        }
Exemplo n.º 9
0
    // Start is called before the first frame update
    void Start()
    {
        state.FoldALLBit();
        state.AddBit(State.Normal);

        face = CharaFaceState.Normal;

        //このオブジェクトのSprteRender取得
        spriteRenderer = gameObject.GetComponent <SpriteRenderer>();

        var obj = GameObject.Find("Themometer_main");

        themoCtrl = obj.GetComponent <ThemometerController>();

        obj      = GameObject.Find("ThemoRangeGauge");
        themoMan = obj.GetComponent <ThemoManager>();

        obj         = GameObject.Find("CustomerManager");
        customerFac = obj.GetComponent <SpawnFactory>();

        animator = GetComponent <Animator>();
        animator.SetBool("Grab", false);
        animator.SetBool("Walk", false);


        //揚げ時間
        friedTimer = new Timer(BurnFriedTime);
        friedTimer.Start();


        //リアクション
        reactionState = ReactionState.None;
        reactionTimer = new Timer(6);
        reactionDisp  = new Vector3(0.5f, 0.5f, PosZ - 0.01f);;
        reactionTimer.EnabledLoop();
        reactionTimer.Start();

        GameDirector.totalCustomerNum++;
    }
Exemplo n.º 10
0
        public async Task <ReactionState> GetState(ReactionTarget targetType, int targetId, int ownerId)
        {
            var reaction = await _context.Reactions.Where(reaction =>
                                                          reaction.Target == targetType &&
                                                          reaction.TargetId == targetId &&
                                                          reaction.OwnerId == ownerId).CountAsync();

            var reactionState = new ReactionState
            {
                IsCreated = 0
            };

            if (reaction != 0)
            {
                reactionState.IsReactedByThisUser = true;
                reactionState.IsCreated           = 1;
                return(reactionState);
            }
            else
            {
                return(reactionState);
            }
        }
Exemplo n.º 11
0
 public void BeginTimer(float pressDelay, float fakeDelay)
 {
     currentState = ReactionState.Waiting;
     StartCoroutine(TaskSequence(pressDelay, fakeDelay));
 }
Exemplo n.º 12
0
        private async Task ModifyRatings(ICacheable <IUserMessage, ulong> cachedMessage, ISocketReaction reaction, ReactionState state)
        {
            if (reaction.Emote.Name != "tldr")
            {
                return;
            }

            var message = await cachedMessage.GetOrDownloadAsync();

            if (message.Content.Length < 100)
            {
                return;
            }

            var roleIds = (reaction.User.GetValueOrDefault() as IGuildUser)?.RoleIds;

            if (roleIds == null)
            {
                return;
            }

            _repasteRatings.TryGetValue(message.Id, out var currentRating);

            var modifier = state == ReactionState.Added ? 1 : -1;

            if (roleIds.Count > 1)
            {
                currentRating += 2 * modifier;
            }
            else
            {
                currentRating += 1 * modifier;
            }

            _repasteRatings[message.Id] = currentRating;

            if (currentRating >= 2)
            {
                await UploadMessage(message);

                _repasteRatings.Remove(message.Id);
            }
        }
Exemplo n.º 13
0
 public void GoBackToInital()
 {
     reactionState = ReactionState.inital;
     Camera.main.GetComponent <CameraZoomer>().MoveAndZoomToGameObject(transform);
     ContinueCanvasTwo.SetActive(false);
 }
Exemplo n.º 14
0
    // Update is called once per frame
    void Update()
    {
        //入浴フラグ折る
        state.FoldBit(State.Intrusion);

        //TODO:客ごとに共通の適正温度にするなら
        var BestFirePowerMin = themoMan.GetBestFirePowerMin();
        var BestFirePowerMax = themoMan.GetBestFirePowerMax();

        //入浴中なら
        if (state.CheckBitOR(State.Bathing | State.FriedBathing))
        {
            animator.SetBool("Grab", false);
            animator.SetBool("Walk", false);
            animator.enabled = false;

            friedTimer.Update();
            reactionTimer.Update();

            //満足度の増減
            var nowFirePower = themoCtrl.GetFirePower();
            if (nowFirePower >= BestFirePowerMin && nowFirePower <= BestFirePowerMax)
            {
                if (!state.CheckBit(State.Burn))
                {
                    satisfy.AddSatisfy();
                    reactionState = ReactionState.Good;
                }
            }
            else
            {
                satisfy.SubSatisfy();
                reactionState = ReactionState.Shock;
            }

            //焦げたら満足度減少
            if (state.CheckBit(State.Burn))
            {
                satisfy.SubSatisfy();
            }

            //揚げ時間を越したら焦げ状態
            if (friedTimer.IsFinish())
            {
                state.AddBit(State.Burn);
                reactionState = ReactionState.Bad;
            }

            if (reactionTimer.IsFinish())
            {
                Reaction();
            }

            //入浴中のお客さんが揚がるかどうか
            if (state.CheckBitOR(State.Bathing) && satisfy.SatisfyValue > FriedSatisfy)
            {
                state.FoldBit(State.Bathing);
                state.AddBit(State.FriedBathing);
                spriteRenderer.sprite = FriedBathingSprite;
            }
        }

        //表情
        FacialExpression();

        if (state.CheckBit(State.Drag))
        {
            return;
        }

        //移動
        Move();

        //画面外で破棄
        ScreenOut();
    }
Exemplo n.º 15
0
        private void btn_solve_reactionSeries_Click(object sender, EventArgs e)
        {
            web_reaction_series.DocumentText = "";

            string _reactionSeriesStr = txt_reactionSeries.Text;
            List <Pair <List <string>, List <string> > > _reactionSeries = Processor.AnalyzeReactionSeries(_reactionSeriesStr);

            int[]           _reactionId    = new int[_reactionSeries.Count];
            ReactionState[] _reactionState = new ReactionState[_reactionSeries.Count];

            for (int i = 0; i < _reactionSeries.Count; i++)
            {
                _reactionId[i]    = -1;
                _reactionState[i] = Processor.GetReactionState(_reactionSeries[i]);
            }

            for (int i = 0; i < _reactionSeries.Count; i++)
            {
                _reactionId[i] = Processor.FindReaction(ReactionList, _reactionSeries[i], _reactionId[i]);

                if (_reactionId[i] == -1)
                {
                    if (i <= 0)
                    {
                        MessageBox.Show("Cannot find reactions! Please check your input...");
                        return;
                    }

                    if ((_reactionState[i] & ReactionState.LEFT_UNKNOWN) == ReactionState.LEFT_UNKNOWN)
                    {
                        string _nextElement = Processor.GetNextElement(_reactionSeries[i].First, _reactionSeries[i].First[0]);

                        if (_nextElement != null)
                        {
                            _reactionSeries[i].First[0]      = Processor.GetNextElement(_reactionSeries[i].First, _reactionSeries[i].First[0]);
                            _reactionSeries[i - 1].Second[0] = _reactionSeries[i].First[0];
                        }
                        else
                        {
                            _reactionSeries[i - 1].Second[0] = _reactionSeries[i].First[0] = "?";
                        }
                    }

                    i--;
                    continue;
                }

                if ((_reactionState[i] & ReactionState.RIGHT_UNKNOWN) == ReactionState.RIGHT_UNKNOWN)
                {
                    _reactionSeries[i].Second[0] = Processor.GetNextElement(ReactionList[_reactionId[i]].Second, _reactionSeries[i].Second[0]);

                    if (i < _reactionSeries.Count - 1)
                    {
                        _reactionSeries[i + 1].First[0] = _reactionSeries[i].Second[0];
                    }
                }
            }

            string _document = "";

            for (int i = 0; i < _reactionSeries.Count; i++)
            {
                Pair <List <List <Element> >, List <List <Element> > > _reactionInfo = new Pair <List <List <Element> >, List <List <Element> > >();
                _reactionInfo.First  = new List <List <Element> >();
                _reactionInfo.Second = new List <List <Element> >();

                List <int> _coefficients = ReactionBalancer.BalanceReaction(ReactionList[_reactionId[i]], _reactionInfo);
                _document += "(" + (i + 1) + "): ";
                _document += Processor.GenerateReaction(_reactionInfo, _coefficients);
                _document += "<br/>";
            }

            web_reaction_series.DocumentText = _document;
        }
Exemplo n.º 16
0
        /// <summary>
        /// Depending on the Reaction Mode(s) selected, this will trigger all reactions
        /// </summary>
        public override void OnInteract(Vector3 contactPoint = new Vector3(), Transform playerGrip = null)
        {
            //Debug.Log("ActivateButton | useParticle: "+useParticle+" | useAudio: "+useAudio+" | useAnimation: "+useAnimation);
            if (reactionState == ReactionState.Ready)
            {
                if (numberOfUses > 0)
                {
                    reactionState = ReactionState.Active;

                    #region Uses & Reuse
                    if (isLimited)
                    {
                        numberOfUses--;
                        if (numberOfUses == 0)
                        {
                            if (destroySelfAfterUse)
                            {
                                willDestroy = true;
                            }

                            reactionState = ReactionState.Finished;
                        }
                    }
                    #endregion

                    #region Ready Setup
                    if (useParticle)
                    {
                        particlesReady = false;
                    }
                    if (useAudio)
                    {
                        audioReady = false;
                    }
                    if (useAnimation)
                    {
                        animationReady = false;
                    }
                    if (useInstantiation)
                    {
                        instantiationReady = false;
                    }
                    #endregion

                    #region Particle Activation
                    if (useParticle)
                    {
                        if (particles != null && particles.instantiationList.Count > 0)
                        {
                            if (particleMode == ContentMode.RandomChoice)
                            {
                                int chosenParticleIndex = Random.Range(0, particles.instantiationList.Count);
                                SingleObjectInstantiation(chosenParticleIndex, true);
                                particlesReady = true;
                            }
                            else
                            {
                                CreateParticles();
                            }
                        }
                        else
                        {
                            Debug.Log("[WARNING] useParticle is enabled but its list is empty");
                        }
                    }
                    #endregion

                    #region Audio Activation
                    if (useAudio)
                    {
                        if (audio != null && audio.audioList.Count > 0)
                        {
                            if (audioMode == ContentMode.RandomChoice)
                            {
                                int chosenAudioIndex = Random.Range(0, audio.audioList.Count);
                                StartCoroutine(SingleAudioPlay(audio.audioList[chosenAudioIndex]));
                                audioReady = true;
                            }
                            else
                            {
                                PlayAudio();
                            }
                        }
                        else if (useAudio)
                        {
                            Debug.Log("[WARNING] useAudio is enabled but its list is empty");
                        }
                    }
                    #endregion

                    #region Animation Toggle
                    if (useAnimation)
                    {
                        if (animationConditions != null && animationConditions.animationConditionList != null && animationConditions.animationConditionList.Count > 0)
                        {
                            if (animationMode == ContentMode.RandomChoice)
                            {
                                int chosenAnimationIndex = Random.Range(0, animationConditions.animationConditionList.Count);

                                SingleAnimationToggle(animationConditions.animationConditionList[chosenAnimationIndex]);

                                if (!animationConditions.animationConditionList[chosenAnimationIndex].dontReturnToDefaultAfterAnimationLength)
                                {
                                    activatedAnimationConditions.Add(animationConditions.animationConditionList[chosenAnimationIndex]);
                                }
                                animationReady = true;
                            }
                            else
                            {
                                ToggleAnimation();
                                if (animationLength > -1)
                                {
                                    Invoke("FinishedAnimation", animationLength);
                                }
                            }
                        }
                        else
                        {
                            Debug.Log("[WARNING] useAnimation is enabled but its list is empty");
                        }
                    }
                    #endregion

                    #region GameObject Instantiation
                    if (useInstantiation)
                    {
                        if (instantiations != null && instantiations.instantiationList.Count > 0)
                        {
                            if (instantiationMode == ContentMode.RandomChoice)
                            {
                                int chosenInstantiationIndex = Random.Range(0, instantiations.instantiationList.Count);
                                SingleObjectInstantiation(chosenInstantiationIndex, false);
                                instantiationReady = true;
                            }
                            else
                            {
                                InstantiateGameObjects();
                            }
                        }
                    }
                    #endregion

                    #region Relocation Activation
                    if (useRelocation)
                    {
                        if (relocationPoints != null && relocationPoints.relocationList.Count > 0)
                        {
                            if (isRelocationRandom)
                            {
                                int chosenRelocationIndex = Random.Range(0, relocationPoints.relocationList.Count);
                                SingleObjectRelocation(chosenRelocationIndex);
                            }
                            else
                            {
                                RelocateGameObject();
                            }
                        }
                        else
                        {
                            Debug.Log("[WARNING] useRelocation is enabled but its list is empty");
                        }
                    }
                    #endregion
                }
            }
        }