protected override void OnStart() { EmotionSpectrum currentEmotion = ProceduralEngine.Instance.GetCurrentEmotion(); float expectation = currentEmotion.Dot(new EmotionSpectrum(EmotionVector.GetCoreEmotion(CoreEmotion.Anticipation))); camera.RotationDampingTime = .1f + Mathf.Lerp(.4f, 0f, Mathf.Clamp01(expectation - 2f)); camera.PositionDampingTime = .1f + Mathf.Lerp(.4f, 0f, Mathf.Clamp01(expectation - 2f)); camera.SetNoiseParameters(Mathf.Clamp(expectation * .4f, 0f, .25f), .75f); Vector3 boundsAxis = mainInterestPoint.AssociatedItemBounds.size.normalized; List <KeyValuePair <Vector3, float> > possibleDirections = new List <KeyValuePair <Vector3, float> >(); // Chance of following the frustum average possibleDirections.Add(new KeyValuePair <Vector3, float>(mainInterestAxis, .5f)); // Chance of picking a dolly direction based on the item boundaries possibleDirections.Add(new KeyValuePair <Vector3, float>(mainInterestPoint.transform.right * boundsAxis.x, boundsAxis.x)); possibleDirections.Add(new KeyValuePair <Vector3, float>(mainInterestPoint.transform.up * boundsAxis.y, boundsAxis.y)); possibleDirections.Add(new KeyValuePair <Vector3, float>(mainInterestPoint.transform.forward * boundsAxis.z, boundsAxis.z)); // Chance of doing a dolly in/out float inOutDirection = ProceduralEngine.Instance.EmotionEngine.GetStructureAtTime(ProceduralEngine.Instance.CurrentTimeNormalized) == StructureType.Decreasing ? -1f : 1f; possibleDirections.Add(new KeyValuePair <Vector3, float>(GetForward() * inOutDirection, .5f)); movementDirection = ProceduralEngine.SelectRandomWeighted(possibleDirections, x => x.Value).Key.normalized; keepAttention = ProceduralEngine.RandomRange(0f, 1f) > .5f; // TODO: associate this with the rotation smoothness/lag, and with emotions (e.g. sadness lags, expectation keeps) }
public void Awake() { if (DirectorNotAvailable) { return; } internalSpectrum = new EmotionSpectrum(EmotionVector.GetCoreEmotion(primaryAffinity)); if (ProceduralCameraDirector.IsAvailable()) { ProceduralCameraDirector.Instance.RegisterInterestPoint(this); } else { DirectorNotAvailable = true; } }
// Eh, this is a very simplistic way of approaching the problem public static CoreEmotion FindMainEmotion(EmotionSpectrum e) { CoreEmotion maxEmotion = CoreEmotion.Anger; float maxEmotionValue = 0f; // TODO: Add some fuzziness by picking the best 3 emotions found, or something foreach (CoreEmotion core in System.Enum.GetValues(typeof(CoreEmotion))) { float dot = new EmotionSpectrum(EmotionVector.GetCoreEmotion(core)).Dot(e); if (dot > maxEmotionValue) { maxEmotion = core; maxEmotionValue = dot; } } return(maxEmotion); }
public void Awake() { this.internalSpectrum = new EmotionSpectrum(EmotionVector.GetCoreEmotion(emotionAffinity)); this.interestPoints = new List <InterestPoint>(GetComponentsInChildren <InterestPoint>()); OnAwake(); }