/// <summary> /// Reads the unmanaged data from the native value. /// </summary> /// <param name="nativeValue">Input native value</param> void IMarshalable <NodeAnimationChannel, AiNodeAnim> .FromNative(ref AiNodeAnim nativeValue) { m_nodeName = nativeValue.NodeName.GetString(); m_preState = nativeValue.Prestate; m_postState = nativeValue.PostState; m_positionKeys.Clear(); m_rotationKeys.Clear(); m_scalingKeys.Clear(); if (nativeValue.NumPositionKeys > 0 && nativeValue.PositionKeys != IntPtr.Zero) { m_positionKeys.AddRange(MemoryHelper.FromNativeArray <VectorKey>(nativeValue.PositionKeys, (int)nativeValue.NumPositionKeys)); } if (nativeValue.NumRotationKeys > 0 && nativeValue.RotationKeys != IntPtr.Zero) { m_rotationKeys.AddRange(MemoryHelper.FromNativeArray <QuaternionKey>(nativeValue.RotationKeys, (int)nativeValue.NumRotationKeys)); } if (nativeValue.NumScalingKeys > 0 && nativeValue.ScalingKeys != IntPtr.Zero) { m_scalingKeys.AddRange(MemoryHelper.FromNativeArray <VectorKey>(nativeValue.ScalingKeys, (int)nativeValue.NumScalingKeys)); } }
/// <summary> /// Nota: Si hay errores de Quaternion to Matrix comprobar que los parametros enviados son validos para el ejercicio indicado /// </summary> /// <param name="e"></param> /// <param name="param"></param> public void PrepareExercise(Exercise e, BehaviourParams param) { param.Angle = AngleFixer.FixAngle(param.Angle, e.Movement); if (param.Variations == null || param.Variations.Count == 0) { behaviour = AnimationBehaviour.GetBehaviour(e.Movement, e.Limb); } else { behaviour = AnimationBehaviour.GetCentralBehaviour(e.Movement, e.Limb); } if (behaviour == null) { Debug.LogError("No se encontró la máquina de estado. (Ejercicio = " + e.Movement + " " + (int)e.Movement + ") (Limb = " + e.Limb + ")" + "). Posiblemente se deba a una mala combinación de esos parámetros o el MonitoAnimatorController se bugeó"); return; } behaviour.Prepare(param); behaviour.RepetitionEnd += behaviour_PrepareEnd; if (param.Variations == null || param.Variations.Count == 0) { CurrentExercise = e; } else { CurrentExercise = new Exercise(behaviour.randomAnimations[0], e.Limb); } }
public IdleState( MovementBehaviour movementBehaviour, AnimationBehaviour animationBehaviour) { _movementBehaviour = movementBehaviour; _animationBehaviour = animationBehaviour; }
void OnAnimDestroy(AnimationBehaviour anim, float time) { foreach (var ground in _grounds) { ground.localScale = Vector3.one * time; } }
public static void PlayCubeDroppedSound(this AnimationBehaviour target) { if (CurrentUserInfo.IsSoundEnabled) { target.GetComponent <AudioSource>().Play(); } }
/// <summary> /// Initializes a new instance of <see cref="AnimationNode"/> class. /// </summary> /// <param name="name">The name of the animation node.</param> /// <param name="positionKeys">The position keys data.</param> /// <param name="rotationKeys">The rotation keys data.</param> /// <param name="scalingKeys">The scaling keys data.</param> /// <param name="preState">The behaviour of the animation before the first key is encountered.</param> /// <param name="postState">The behaviour of the animation after the last key was processed.</param> public AnimationNode( string name, ReadOnlySpan <Vector3Key> positionKeys, ReadOnlySpan <QuaternionKey> rotationKeys, ReadOnlySpan <Vector3Key> scalingKeys, AnimationBehaviour preState = AnimationBehaviour.Default, AnimationBehaviour postState = AnimationBehaviour.Default) { Name = name; PreState = preState; PostState = postState; _positionKeys = Array.Empty <Vector3Key>(); _rotationKeys = Array.Empty <QuaternionKey>(); _scalingKeys = Array.Empty <Vector3Key>(); _positionKeysCount = _rotationKeysCount = _scalingKeysCount = 0; var positions = Sort(positionKeys); var rotations = Sort(rotationKeys); var scales = Sort(scalingKeys); InternalHelper.Set(ref _positionKeys, ref _positionKeysCount, positions); InternalHelper.Set(ref _rotationKeys, ref _rotationKeysCount, rotations); InternalHelper.Set(ref _scalingKeys, ref _scalingKeysCount, scales); _hashcode = 0; _hashcode = HashHelper <AnimationNode> .Combine( Name, PostState, PreState, HashHelper <Vector3Key> .Combine(PositionKeys), HashHelper <QuaternionKey> .Combine(RotationKeys), HashHelper <Vector3Key> .Combine(ScalingKeys)); }
public static AnimationBehaviour GetBehaviour(Movement m, Limb l) { int mov_search = (int)m / MAGIC_NUMBER; AnimationBehaviour encontrado = null; Animator a = GameObject.FindObjectOfType <AnimatorScript>().anim; AnimationBehaviour[] behaviours = a.GetBehaviours <AnimationBehaviour>(); foreach (AnimationBehaviour lb in behaviours) { int lb_mov = (int)lb.movement / MAGIC_NUMBER; if (lb_mov == mov_search) { if (lb.animator == null) { lb.animator = a; } if (lb.IsCentralNode && lb.limb == l) { // Si se encontró un nodo central que calce con el 'Movement' entonces se retorna. encontrado = lb; break; } else if (!lb.HasCentralNode && lb.movement == m && l == lb.limb) { encontrado = lb; } } } // Si no es un movimiento con nodo central, entonces se retorna. Se asume sin problemas que es el único encontrado. return(encontrado); }
void behaviour_PrepareEnd(object sender, EventArgs e) { // GoToIddle(); //DebugLifeware.Log("Preparación terminada", DebugLifeware.Developer.Marco_Rojas); behaviour = sender as AnimationBehaviour; behaviour.RepetitionEnd -= behaviour_PrepareEnd; RaiseEvent(OnPrepareExerciseEnd, PrepareStatus.Prepared); }
private void Awake() { _player = GameObject.FindGameObjectWithTag(Tags.PLAYER).transform; _movementBehaviour = GetComponent <MovementBehaviour>(); _animationBehaviour = GetComponent <AnimationBehaviour>(); _visionSensor = GetComponent <VisionSensor>(); CreateStages(); }
void Awake() { characterSource = gameObject.AddComponent <AudioSource>(); characterSource.volume = 1.0f; characterSource.loop = false; characterSource.playOnAwake = false; charAnim = gameObject.GetComponent <AnimationBehaviour>(); }
public void RunExerciseWeb(string s) { BehaviourParams p = JsonConvert.DeserializeObject <BehaviourParams>(s); behaviour = AnimationBehaviour.GetBehaviour(CurrentExercise.Movement, CurrentExercise.Limb); behaviour.Stop(); p.Angle = AngleFixer.FixAngle(p.Angle, CurrentExercise.Movement); StartCoroutine(RunWebInSeconds(0.4f, p)); }
public void RunExercise(bool isInInstruction) { behaviour = AnimationBehaviour.GetBehaviour(CurrentExercise.Movement, CurrentExercise.Limb); behaviour.Run(isInInstruction); RewindExercise(); behaviour.RepetitionEnd -= behaviour_RepetitionEnd; behaviour.RepetitionEnd += behaviour_RepetitionEnd; behaviour.RepetitionReallyStart -= behaviour_RepetitionReallyStart; behaviour.RepetitionReallyStart += behaviour_RepetitionReallyStart; }
protected void initializeRandomAnimations(List <Movement> animations) { AnimationBehaviour central = AnimationBehaviour.GetCentralBehaviour(this.movement, this.limb); AnimationBehaviour ab = (AnimationBehaviour)central; ab.randomAnimations = animations; ab.actualRandomAnimationIndex = 0; //ab.friendsBehaviours = this.friendsBehaviours; }
/// <summary> /// Constructs a new instance of the <see cref="NodeAnimationChannel"/> class. /// </summary> public NodeAnimationChannel() { m_nodeName = String.Empty; m_preState = AnimationBehaviour.Default; m_postState = AnimationBehaviour.Default; m_positionKeys = new List <VectorKey>(); m_rotationKeys = new List <QuaternionKey>(); m_scalingKeys = new List <VectorKey>(); }
public CatchState( Transform owner, Transform player, AnimationBehaviour animationBehaviour, MovementBehaviour movementBehaviour) { _owner = owner; _player = player; _animationBehaviour = animationBehaviour; _movementBehaviour = movementBehaviour; }
protected void initializeRandomAnimations() { this.CentralNode.randomAnimations = new List <Movement>(); List <AnimationBehaviour> friends = AnimationBehaviour.getFriendBehaviours(this.movement); foreach (AnimationBehaviour a in friends) { //randomAnimations.Add(new Movement(a.movement, a.laterality, a.limb)); this.CentralNode.randomAnimations.Add(a.movement); } }
void Awake() { if (!Instance) { Instance = this; } else { Debug.Log("Already in the Scene !"); Destroy(this); } }
void OnAnimMoveToContainer(AnimationBehaviour anim, float time) { var data = (Dictionary <string, object>)anim.Data; var camera = data["camera"] as CameraController; var position = (Vector3)data["position"]; var rotation = (Quaternion)data["rotation"]; var orthographicSize = (float)data["orthographicSize"]; camera.transform.localPosition = Vector3.Lerp(position, Vector3.zero, time); camera.transform.localRotation = Quaternion.Slerp(rotation, Quaternion.identity, time); camera.GetComponent <Camera>().orthographicSize = Mathf.Lerp(orthographicSize, _orthographicSize, time); }
public void Start() { OriginalPosition = ReferenceObject.transform.position; animationBehaviour = ReferenceObject.AddComponent(AnimationFactory.MakeAnimation(AnimationType)) as AnimationBehaviour; if (AnimationSettings != null) { animationBehaviour.AnimationSettings = AnimationSettings; } animationBehaviour.SetupSettings(); animationBehaviour.OnComplete = OnComplete; animationBehaviour.StartAnimate(); }
void behaviour_PrepareEndWeb(object sender, EventArgs e) { //behaviour = sender as LerpBehaviour; behaviour = sender as AnimationBehaviour; behaviour.RepetitionEnd -= behaviour_PrepareEndWeb; //Debug.Log(timeSinceStartPrepareWeb + " < " + Time.time + " - " + DELAY_TO_FAST_PREPARE + " =" + (Time.time - DELAY_TO_FAST_PREPARE)); if (timeSinceStartPrepareWeb > Time.time - DELAY_TO_FAST_PREPARE) { StartCoroutine(RaiseEvent(OnPrepareExerciseEnd, PrepareStatus.Prepared, DELAY_TO_FAST_PREPARE)); } else { RaiseEvent(OnPrepareExerciseEnd, PrepareStatus.Prepared); } }
public void Init(float speedFactor, float strafeFactor, float alpha) { this.alpha = alpha; BlendShaders(transform); this.speedFactor = speedFactor; this.strafeFactor = strafeFactor; AnimationBehaviour anim = GetComponent <AnimationBehaviour>(); if (null != anim) { anim.Init(speedFactor); } }
void StratAnimation(float targetValue, PostEffectsTypes type, Action <AnimationBehaviour> animationFinishedHandler = null) { AnimationBehaviour behaviour = m_AnimationBehaviours[type]; //Событие окончания анимации if (animationFinishedHandler != null) { behaviour.OnAnimationFinished += animationFinishedHandler; } //Добавить эффект в список активных m_ActiveAnimationBehaviours.Add(behaviour); //Начать анимацию behaviour.StartAnimation(targetValue); }
public void StopExercise() { behaviour = AnimationBehaviour.GetBehaviour(CurrentExercise.Movement, CurrentExercise.Limb); if (behaviour == null) { return; } behaviour.Stop(); behaviour.RepetitionEnd -= behaviour_RepetitionEnd; behaviour.RepetitionEnd -= behaviour_PrepareEnd; behaviour.RepetitionEnd -= behaviour_PrepareEndWeb; behaviour.RepetitionReallyStart -= behaviour_RepetitionReallyStart; }
void ColorGradingNormalizeAnimationFinished(AnimationBehaviour behaviour) { behaviour.OnAnimationFinished -= ColorGradingNormalizeAnimationFinished; //Выключить Color grading m_Profile.colorGrading.enabled = false; //Выключить камеру if (ColorGradingCamera.enabled) { ColorGradingCamera.enabled = false; } //Выключить обработку эффектов if (Behaviour.enabled) { Behaviour.enabled = false; } }
/// <summary> /// Constructs a new NodeAnimation. /// </summary> /// <param name="nodeAnim">Unmanaged AiNodeAnim struct</param> internal NodeAnimationChannel(AiNodeAnim nodeAnim) { _nodeName = nodeAnim.NodeName.GetString(); _preState = nodeAnim.Prestate; _postState = nodeAnim.PostState; //Load position keys if(nodeAnim.NumPositionKeys > 0 && nodeAnim.PositionKeys != IntPtr.Zero) { _positionKeys = MemoryHelper.MarshalArray<VectorKey>(nodeAnim.PositionKeys, (int) nodeAnim.NumPositionKeys); } //Load rotation keys if(nodeAnim.NumRotationKeys > 0 && nodeAnim.RotationKeys != IntPtr.Zero) { _rotationKeys = MemoryHelper.MarshalArray<QuaternionKey>(nodeAnim.RotationKeys, (int) nodeAnim.NumRotationKeys); } //Load scaling keys if(nodeAnim.NumScalingKeys > 0 && nodeAnim.ScalingKeys != IntPtr.Zero) { _scalingKeys = MemoryHelper.MarshalArray<VectorKey>(nodeAnim.ScalingKeys, (int) nodeAnim.NumScalingKeys); } }
public void PrepareExerciseWeb(string s) { RaiseEvent(OnPrepareExerciseStart, PrepareStatus.Preparing); PrepareExerciseWebParams pwp = JsonConvert.DeserializeObject <PrepareExerciseWebParams>(s); Exercise e = (pwp.Exercise) as Exercise; this.prepareCaller = (Caller)(pwp.Caller); //Exercise e = JsonConvert.DeserializeObject<Exercise>(s); behaviour = AnimationBehaviour.GetBehaviour(e.Movement, e.Limb); if (behaviour == null) { DebugLifeware.LogAllDevelopers("Importante: Behaviour no encontrado"); RaiseEvent(OnPrepareExerciseEnd, PrepareStatus.NotFound); return; } behaviour.RepetitionEnd += behaviour_PrepareEndWeb; timeSinceStartPrepareWeb = Time.time; behaviour.PrepareWeb(); CurrentExercise = e; }
/// <summary> /// Creates a new animation sampler from a list of keyframes /// </summary> /// <param name="keyframes">List of samples</param> /// <param name="interpolation">Interpolation method to use</param> public JointAnimationSampler(JointAnimationKeyFrame[] keyframes, AnimationInterpolation interpolation) { _keyframes = keyframes; _interpolation = interpolation; if (_interpolation != AnimationInterpolation.Linear) { // Right now only linear interpolation is supported _interpolation = AnimationInterpolation.Linear; } if (keyframes == null || keyframes.Length == 0) { throw new ApplicationException("Sampler needs keyframes"); } StartTime = keyframes[0].Time; EndTime = keyframes[keyframes.Length - 1].Time; PostBehaviour = AnimationBehaviour.Cycle; }
public void Play(AnimationBehaviour behaviour) { throw new NotImplementedException(); }
public void Play(AnimationBehaviour behaviour, AnimationDirection direction, int loopCount) { throw new NotImplementedException(); }
public void Play(AnimationBehaviour behaviour, AnimationDirection direction) { }
public void Play(AnimationBehaviour behaviour) { }
public void Play(AnimationBehaviour behaviour, AnimationDirection direction, int loopCount) { }
void behaviour_PrepareEndWeb(object sender, EventArgs e) { //behaviour = sender as LerpBehaviour; behaviour = sender as AnimationBehaviour; behaviour.RepetitionEnd -= behaviour_PrepareEndWeb; //Debug.Log(timeSinceStartPrepareWeb + " < " + Time.time + " - " + DELAY_TO_FAST_PREPARE + " =" + (Time.time - DELAY_TO_FAST_PREPARE)); if (timeSinceStartPrepareWeb > Time.time - DELAY_TO_FAST_PREPARE) StartCoroutine(RaiseEvent(OnPrepareExerciseEnd, PrepareStatus.Prepared, DELAY_TO_FAST_PREPARE)); else RaiseEvent(OnPrepareExerciseEnd, PrepareStatus.Prepared); }
void VignetteHideAnimationFinished(AnimationBehaviour behaviour) { behaviour.OnAnimationFinished -= VignetteHideAnimationFinished; Vignette.enabled = false; }
public void StopExercise() { behaviour = AnimationBehaviour.GetBehaviour(CurrentExercise.Movement, CurrentExercise.Limb); if (behaviour == null) return; behaviour.Stop(); behaviour.RepetitionEnd -= behaviour_RepetitionEnd; behaviour.RepetitionEnd -= behaviour_PrepareEnd; behaviour.RepetitionEnd -= behaviour_PrepareEndWeb; behaviour.RepetitionReallyStart -= behaviour_RepetitionReallyStart; }
public void RunExerciseWebWithoutParams() { behaviour = AnimationBehaviour.GetBehaviour(CurrentExercise.Movement, CurrentExercise.Limb); behaviour.Stop(); StartCoroutine(RunWebInSeconds(0.4f)); }
public void RunExerciseWeb(string s) { BehaviourParams p = JsonConvert.DeserializeObject<BehaviourParams>(s); behaviour = AnimationBehaviour.GetBehaviour(CurrentExercise.Movement, CurrentExercise.Limb); behaviour.Stop(); p.Angle = AngleFixer.FixAngle(p.Angle, CurrentExercise.Movement); StartCoroutine(RunWebInSeconds(0.4f, p)); }
void AnimationFinishedHandler(AnimationBehaviour behaviour) { m_ActiveAnimationBehaviours.Remove(behaviour); Disable(); }
public void ResumeExercise() { behaviour = AnimationBehaviour.GetBehaviour(CurrentExercise.Movement, CurrentExercise.Limb); behaviour.ResumeAnimation(); }
/// <summary> /// Nota: Si hay errores de Quaternion to Matrix comprobar que los parametros enviados son validos para el ejercicio indicado /// </summary> /// <param name="e"></param> /// <param name="param"></param> public void PrepareExercise(Exercise e, BehaviourParams param) { param.Angle = AngleFixer.FixAngle(param.Angle, e.Movement); if (param.Variations == null || param.Variations.Count == 0) behaviour = AnimationBehaviour.GetBehaviour(e.Movement, e.Limb); else behaviour = AnimationBehaviour.GetCentralBehaviour(e.Movement, e.Limb); if (behaviour == null) { Debug.LogError("No se encontró la máquina de estado. (Ejercicio = " + e.Movement + " " + (int)e.Movement + ") (Limb = " + e.Limb + ")" + "). Posiblemente se deba a una mala combinación de esos parámetros o el MonitoAnimatorController se bugeó"); return; } behaviour.Prepare(param); behaviour.RepetitionEnd += behaviour_PrepareEnd; if (param.Variations == null || param.Variations.Count == 0) CurrentExercise = e; else CurrentExercise = new Exercise(behaviour.randomAnimations[0], e.Limb); }
public void PrepareExerciseWeb(string s) { RaiseEvent(OnPrepareExerciseStart, PrepareStatus.Preparing); PrepareExerciseWebParams pwp = JsonConvert.DeserializeObject<PrepareExerciseWebParams>(s); Exercise e = (pwp.Exercise) as Exercise; this.prepareCaller = (Caller)(pwp.Caller); //Exercise e = JsonConvert.DeserializeObject<Exercise>(s); behaviour = AnimationBehaviour.GetBehaviour(e.Movement, e.Limb); if (behaviour == null) { DebugLifeware.LogAllDevelopers("Importante: Behaviour no encontrado"); RaiseEvent(OnPrepareExerciseEnd, PrepareStatus.NotFound); return; } behaviour.RepetitionEnd += behaviour_PrepareEndWeb; timeSinceStartPrepareWeb = Time.time; behaviour.PrepareWeb(); CurrentExercise = e; }