Ejemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            if (divider == null)
            {
                divider = new GUIStyle(GUI.skin.box);
            }

            DrawDefaultInspector();

            ActivityBase aScript = (ActivityBase)target;

            GUILayout.BeginHorizontal(divider);
            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("Hide visuals"))
            {
                aScript.SetVisuals(false);
            }
            else if (GUILayout.Button("Show visuals"))
            {
                aScript.SetVisuals(true);
            }

            EditorGUILayout.EndHorizontal();
            GUILayout.EndHorizontal();
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Pass name of ActivityBase-derived class.
        /// Default to finishing current activity even
        /// if we don't find the new one.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="finishCurrent"></param>
        public void SetActivity(string name, bool finishCurrent = true)
        {
            if (finishCurrent && currentActivity != null)
            {
                Debug.Log("Finishing current activity: " + currentActivity.GetType().Name);

                currentActivity.Finish();
                currentActivity = null;
            }

            for (int i = 0; i < activities.Length; i++)
            {
                if (activities[i].GetType().Name == name)
                {
                    Debug.Log("Starting new activity: " + name);

                    currentActivity = activities[i];
                    currentActivity.Initialize();

                    break;
                }
            }

            if (!currentActivity)
            {
                Debug.LogWarning("Activity not found: " + name);
            }
        }
        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);
        }
Ejemplo n.º 5
0
        public virtual void Enter(ActivityBase associatedActivity, StateProcessor previousState = null)
        {
            if (previousState != null)
            {
                previousState.Exit();
            }

            gameObject.SetActive(true);

            currentActivity = associatedActivity;

            timeRemaining = timeToCompleteActivity;

            if (playerInitialAspect)
            {
                ControllerInput.Instance.SetPlayerAspect(playerInitialAspect);
            }

            if (sharedStateObjects != null)
            {
                foreach (GameObject so in sharedStateObjects)
                {
                    if (so)
                    {
                        so.SetActive(true);
                    }
                }
            }

            slowFrameInterval = ActivitySettings.Asset.slowFrameInterval; // Cache instead of hitting every frame

            ShowVisuals(true);
            ControllerInput.Instance.LockPlayer(!freeMovement, !useGravity);

            if (excludedStateVisuals.Length > 0)
            {
                foreach (GameObject g in excludedStateVisuals)
                {
                    if (g)
                    {
                        g.SetActive(false);
                    }
                }
            }

            timerRunning  = false;
            timerDisabled = false;

            if (introSound)
            {
                ControllerInput.Instance.PlayVoiceover(introSound);
            }

            Debug.Log("Entering State " + GetType().Name + " for Activity " + currentActivity.name);
        }
Ejemplo n.º 6
0
        public void SetActivity(ActivityBase activity, bool finishCurrent = true)
        {
            if (finishCurrent && currentActivity != null)
            {
                Debug.Log("Finishing current activity: " + currentActivity.GetType().Name);

                currentActivity.Finish();
                currentActivity = null;
            }

            currentActivity = activity;

            if (currentActivity)
            {
                currentActivity.Initialize();
            }
        }
Ejemplo n.º 7
0
        public override void Enter(ActivityBase a, StateProcessor previousState)
        {
            base.Enter(a, previousState);

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

            LeanTween.delayedCall(ActivitySettings.Asset.titleDisplayTime, () =>
            {
                ActivityManager.Instance.FadeOutThen(() => { ActivityManager.Instance.Next(); });
            });

            Camera.main.clearFlags = CameraClearFlags.SolidColor;

            if (voiceover)
            {
                ControllerInput.Instance.PlayVoiceover(voiceover);
            }
        }
Ejemplo n.º 8
0
        public void SetActivity(System.Type type, bool finishCurrent = true)
        {
            if (finishCurrent && currentActivity != null)
            {
                Debug.Log("Finishing current activity: " + currentActivity.GetType().Name);

                currentActivity.Finish();
                currentActivity = null;
            }

            currentActivity = activities.SingleOrDefault(s => s.GetType() == type);
            Debug.Assert(currentActivity, "No activity found that matches type " + type);

            if (currentActivity)
            {
                currentActivity.Initialize();
            }
        }
Ejemplo n.º 9
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(); });
                });
            }
        }
Ejemplo n.º 10
0
        public override void Enter(ActivityBase a, StateProcessor previousState)
        {
            base.Enter(a, previousState);

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

            foreach (var p in placeables)
            {
                p.CallOnDrop = OnPlaceableDrop;
                if (!addedItems.ContainsKey(p.name))
                {
                    addedItems[p.name] = 0;
                }
            }

            foreach (var r in pourables)
            {
                r.CallOnDrop      = OnPourDrop;
                r.Pouring         = OnPouring;
                r.CallOnEnter     = OnEnterZone;
                r.CallOnExit      = OnExitZone;
                r.PouringComplete = OnFinishedPouring;
            }

            foreach (var s in sliceables)
            {
                s.CallOnDrop = OnSliceableDrop;
            }

            addSlicesButton.Show(false);
            addSlicesButton.clickUpAction = AddSlices;
            infoPanel.Show(false);
            dropInfo.Show(false);
            controlKnob.Show(false);

            Utils.OptSkipButton("Skip salad preparation", continueButton);

            ControllerInput.Instance.LockPlayer(false);

            chefEvaluation.SetActive(false);
            chefExpression.Init();
            chefExpression.Neutral();
        }
        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;
        }
Ejemplo n.º 12
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(); });
            });
        }
Ejemplo n.º 13
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);
        }