예제 #1
0
        public override void Enter(ActivityBase a, StateProcessor previousState)
        {
            base.Enter(a, previousState);

            ControllerInput.Instance.PointerMode = ControllerInput.EnPointerMode.Pointing;

            if (infoPanel)
            {
                infoPanel.SetText(string.Format(startPrompt, Utils.Minutised(timeToCompleteActivity)));
            }

            if (continueButton)
            {
                continueButton.Activate(continuePrompt, (continueButton) =>
                {
                    ActivityManager.Instance.FadeOutThen(() => { ActivityManager.Instance.Next(); });
                });
            }

            switch1.NotifyOnSwitch = Switched1;
            switch2.NotifyOnSwitch = Switched2;

            circuitState = Circuit.CircuitType.Open;
            circuit.CallOnTraceComplete = OnTraceComplete;

            foreach (Block b in blockComponents)
            {
                b.OnConnectionChanged = ConnectionUpdated;
            }

            ControllerInput.Instance.PlayVoiceover(voiceover);
        }
예제 #2
0
 /// <summary>
 /// This means we've finished the slicing
 /// session. UPDATE: noit doesn't
 /// </summary>
 /// <param name="g"></param>
 private void KnobReleased(Graspable g)
 {
     if (dropInfo)
     {
         dropInfo.SetText("Add " + currrentSliceTarget.SliceCount + " slices");
     }
 }
        public override void Enter(ActivityBase a, StateProcessor previousState)
        {
            base.Enter(a, previousState);

            ControllerInput.Instance.PointerMode = ControllerInput.EnPointerMode.Pointing;

            if (infoPanel)
            {
                infoPanel.SetText(startPrompt);
            }

            if (continueButton)
            {
                continueButton.Activate(continuePrompt, (continueButton) =>
                {
                    ActivityManager.Instance.FadeOutThen(() => { ActivityManager.Instance.Next(); });
                });
            }

            foreach (ClickableObject s in selectables)
            {
                s.OnClick      = Select;
                s.PointerEnter = OnTerminalPointerEnter;
                s.PointerExit  = OnTerminalPointerExit;
            }

            SetupCorrectList();

            ControllerInput.Instance.PlayVoiceover(voiceover);
        }
예제 #4
0
        void Awake()
        {
            startAngle = transform.localRotation.eulerAngles;
            endAngle   = startAngle;
            endAngle.x = endAngleX;

            isActive          = false;
            shootable.Dormant = true;
            shootable.GetComponent <SpriteRenderer>().sprite = image;
            if (label.Usable() && label != "No label") // hack!
            {
                infoPanel.SetText(label);
            }
            else
            {
                infoPanel.SetText(image.name);
            }
            gameObject.SetActive(false);
        }
예제 #5
0
        public virtual void OnPointerEnter()
        {
            pointerWithin = true;
            if (rolloverPrompt)
            {
                rolloverPrompt.SetActive(true);
                if (!promptsFixed)
                {
                    Utils.FaceCamera(rolloverPrompt.transform, ControllerInput.Instance.Player);
                }
            }

            if (sharedInfo && rolloverTextData.Usable())
            {
                sharedInfo.SetText(rolloverTextData);
            }

            textReceiver?.ReceiveRolloverText(rolloverTextData);

            rolloverAction?.Invoke(this);
        }
예제 #6
0
        public override void Enter(ActivityBase a, StateProcessor previousState)
        {
            base.Enter(a, previousState);

            ControllerInput.Instance.PointerMode = ControllerInput.EnPointerMode.Pointing;

            if (infoPanel)
            {
                infoPanel.SetText(string.Format(startPrompt, Utils.Minutised(timeToCompleteActivity)));
            }

            if (continueButton)
            {
                continueButton.Activate(continuePrompt, (continueButton) =>
                {
                    ActivityManager.Instance.FadeOutThen(() => { ActivityManager.Instance.Next(); });
                });
            }

            int ix = 0;

            foreach (Switchable v in fuses)
            {
                v.CallOnSwitchId = OnSwitch;
                v.SetLabel(fuseMarkers[ix++]);
            }

            spitznsparkz.SetActive(true);

            electrician.Talk(voiceover);
            electrician.SetAnimation("Walk");
            electrician.restingAnim = "Idle";
            electrician.transform.Set(electricianStartPosition);
            electrician.MoveAlongPathThen(electricianPath, 3f, "Idle");

            //ControllerInput.Instance.PlayVoiceover(voiceover);
        }
예제 #7
0
 public virtual void SetColliderInfo(string info)
 {
     if (colliderText)
     {
         colliderText.gameObject.SetActive(true);
         if (info.Usable())
         {
             colliderText.SetText(info);
         }
         if (!fixedLabel)
         {
             Utils.FaceCamera(colliderText.transform);
         }
     }
 }
예제 #8
0
        public override void Enter(ActivityBase a, StateProcessor previousState)
        {
            base.Enter(a, previousState);

            ControllerInput.Instance.PointerMode = ControllerInput.EnPointerMode.Pointing;

            if (infoPanel)
            {
                infoPanel.SetText(startPrompt);
            }

            if (continueButton)
            {
                continueButton.Activate(continuePrompt, (continueButton) =>
                {
                    ActivityManager.Instance.FadeOutThen(() => { ActivityManager.Instance.Next(); });
                });
            }
        }
예제 #9
0
        public override void Enter(ActivityBase a, StateProcessor previousState)
        {
            base.Enter(a, previousState);

            ControllerInput.Instance.PointerMode = ControllerInput.EnPointerMode.None;

            if (infoPanel)
            {
                infoPanel.SetText(startPrompt);
            }

            // ContinueButton action can be set here, but for convenience for non-programmers
            // it can also be set with a UnityEvent on the activity's scene
            // content folder (in this case ChallengeObjects) Continue button.
            // For the last state in the group, drag the ActivityManager scene object, which contains a
            // SceneLoader component, to the UnityEvent and select SceneLoader/LoadScene
            // and set the text to Start.

            LeanTween.delayedCall(ActivitySettings.Asset.titleDisplayTime, () =>
            {
                ActivityManager.Instance.FadeOutThen(() => { ActivityManager.Instance.Next(); });
            });
        }
        public override void Enter(ActivityBase a, StateProcessor previousState)
        {
            base.Enter(a, previousState);

            ControllerInput.Instance.PointerMode = ControllerInput.EnPointerMode.Pointing;

            if (infoPanel)
            {
                infoPanel.SetText(string.Format(startPrompt, timeToCompleteActivity));

                if (introOnly)
                {
                    ControllerInput.Instance.PointerMode = ControllerInput.EnPointerMode.None;

                    if (!clickToContinue)
                    {
                        infoPanel.ShowFor(ActivitySettings.Asset.TextDisplayTime(startPrompt), () =>
                        {
                            PostExit(true);
                        });
                    }
                }
            }

            if (continueButton)
            {
                continueButton.Activate(continuePrompt, (continueButton) =>
                {
                    ActivityManager.Instance.FadeOutThen(() => { ActivityManager.Instance.Next(); });
                });
            }

            switch1.NotifyOnSwitch = Switched1;
            switch1.gameObject.SetActive(false);
            device1.OnConnectionChanged = OnConnectionChanged;
            device2.OnConnectionChanged = OnConnectionChanged;
            circuitState = Circuit.CircuitType.Open;
            circuit.CallOnTraceComplete = OnTraceComplete;
        }
예제 #11
0
        private void Finish()
        {
            int    deductions = 0;
            int    bonus = 0, score = 0;
            string response = "";

            DisableTimer();

            complete = true;

            if (catastrophicFail)
            {
                response = "You activated a fuse that was off! Very dangerous. Someone may be working on that circuit. ";
            }
            else
            {
                bool gotResult = selectedSwitches.Contains(correctFuseToSwitchOff);
                if (gotResult)
                {
                    response += string.Format("Fuse {0} is correct. ", correctFuseToSwitchOff);
                    if (selectedSwitches.Count == 1)
                    {
                        response += "Sensational! Did it first try. Sorry about the damaged fuse chart, but you worked around it. ";
                        PlayReward();
                    }
                    else
                    {
                        response += "Faulty circuit shut down. Summary of search for BB power point fuse: ";
                    }
                }

                foreach (var s in selectedSwitches)
                {
                    if ((s >= 1 && s <= 6) || s == 10 || s == 12 || s == 14 || s == 15)
                    {
                        response   += string.Format("Fuse {0} is clearly marked, and doesn't match. ", s);
                        deductions += deductForLabelledFuse;
                    }
                    else if (s == 11 || s == 13)
                    {
                        response   += string.Format("It couldn't be fuse {0}, as it was down while the powerpoint was sparking. What's more, it's very dangerous closing an unknown fuse! ", s);
                        deductions += deductForDownFuse;
                    }
                    else if (s == 7 || s == 9)
                    {
                        response   += string.Format("Fuse {0} is in the part of a clear sequence in the chart, and doesn't match BB. ", s);
                        deductions += deductForSequenceFuse;
                    }
                }

                if (gotResult)
                {
                    score = ActivitySettings.pointsPerChallenge - deductions;
                    if (deductions < 5)
                    {
                        bonus = ActivitySettings.pointsPerChallenge - deductions;
                    }
                }
            }
            Utils.RegisterActivityAndUpdateExperience(score + bonus);

            response += "Points: " + ActivitySettings.Asset.currentActivityScore;

            storeRoomInfoPanel.SetText(response);
            storeRoomInfoPanel.TryBonus();

            infoPanel.SetText(response);
            infoPanel.TryBonus();

            infoPanel.ShowFor(ActivitySettings.Asset.titleDisplayTime, () => { PostExit(true); });
        }
예제 #12
0
        public void Score(Graspable grabbable)
        {
            string result = "";
            int    score  = 0;
            int    total  = 0;

            foreach (var p in pourables)
            {
                bool correct = saladRecipe.IsCorrect(p.name, p.ActualAmount);
                if (correct)
                {
                    score++;
                }
                total++;
                result += string.Format("\n{0}: {1}. ", p.name, correct ? "correct" : "wrong");
            }

            foreach (var kv in addedItems)
            {
                bool correct = true; // made false if there are prep steps and they're wrong
                if (prepSteps.ContainsKey(kv.Key))
                {
                    var arr = prepSteps[kv.Key].ToArray();
                    if (arr.Length > 0)
                    {
                        if (!saladRecipe.PreparationCorrect(kv.Key, arr))
                        {
                            correct = false;
                        }
                    }
                }
                else if (kv.Value != 0)
                {
                    correct = false;
                }

                correct = correct && saladRecipe.IsCorrect(kv.Key, kv.Value);
                if (correct)
                {
                    score++;
                }
                total++;
                result += string.Format("\n{0}: {1}", kv.Key, correct ? "correct" : "wrong");
            }

            Debug.Log(result);

            float unitVal = Utils.UnitValueChallengeScore(score, total);

            int activityScore = Utils.ConvertToActivityScore(unitVal);

            Utils.RegisterActivityAndUpdateExperience(activityScore);

            infoPanel.SetText(string.Format("Your score is {0} out of {1}", activityScore, ActivitySettings.pointsPerChallenge));
            if (unitVal > .85f)
            {
                chefExpression.Happy();
            }
            else if (unitVal > .45f)
            {
                chefExpression.Skeptical();
            }
            else
            {
                chefExpression.Angry();
            }

            infoPanel.ShowFor(ActivitySettings.Asset.infoDisplayTime, () =>
            {
                ActivityManager.Instance.FadeOutThen(() => { ActivityManager.Instance.Next(); });
            });
        }