public void StartBreathing(Breathe breath, float duration)
        {
            if (panting == null)
            {
                Debug.Log("panting");
                return;
            }
            if (breathingIdle == null)
            {
                Debug.Log("idle");
                return;
            }
            if (breathingActive == null)
            {
                Debug.Log("active");
                return;
            }
            if (breath.breath > 0.6f)
            {
                panting.TriggerFacial(duration);
                headAudioSource.PlayNow(panting.audioClip);
            }
            else
            if (breath.breath > 0.3f)
            {
                breathingActive.TriggerFacial(duration);
                headAudioSource.PlayNow(breathingActive.audioClip);
            }
            else
            {
                breathingIdle.TriggerFacial(duration);
                headAudioSource.PlayNow(breathingIdle.audioClip);
            }

            foreach (string key in facialKeys)
            {
                Facial f = facial[key];
                f.shouldFade = true;
            }
        }
Exemple #2
0
        public override void Init()
        {
            try
            {
                emotionEngine = Utils.GetPluginStorableById(containingAtom, "EmotionEngine") as EmotionEngine;

                hipAction = Utils.GetPluginStorableById(containingAtom, "HipThrust") as HipThrust;

                breatheAction = Utils.GetPluginStorableById(containingAtom, "Breathe") as Breathe;

                gaze = Utils.GetPluginStorableById(containingAtom, "Gaze") as Gaze;

                oMeter = Utils.GetPluginStorableById(containingAtom, "OMeter") as OMeter;

                gaze.SetReference(containingAtom.name, "eyeTargetControl");
                gaze.SetLookAtPlayer(-0.10f * Vector3.up);
                gaze.SetGazeDuration(0.2f);

                idle       = new Idle(this);
                sex        = new Sex(this);
                climax     = new Climax(this);
                refractory = new Refractory(this);

                hipState = new StateMachine();

                JSONStorableString debugState = new JSONStorableString("debugState", "");
                CreateTextField(debugState);

                hipState.onStateChanged += (State previous, State next) =>
                {
                    debugState.val = next.ToString();
                };

                hipState.Switch(idle);
            }
            catch (Exception e)
            {
                SuperController.LogError("Exception caught: " + e);
            }
        }