internal void Reset(bool reverse = false, bool resetPos = true, bool resetMove = true) { Looping = false; Reverse = reverse; LastEmissive = new EmissiveState(); if (resetMove) { _currentMove = 0; } if (resetPos) { Part.PositionComp.LocalMatrix = HomePos; } }
public void PlayEmissives(PartAnimation animation) { EmissiveState LastEmissive = new EmissiveState(); for (int i = 0; i < animation.MoveToSetIndexer.Length; i++) { EmissiveState currentEmissive; if (System.WeaponEmissiveSet.TryGetValue(animation.EmissiveIds[animation.MoveToSetIndexer[i][(int)Indexer.EmissiveIndex]], out currentEmissive)) { currentEmissive.CurrentPart = animation.CurrentEmissivePart[animation.MoveToSetIndexer[i][(int)Indexer.EmissivePartIndex]]; if (currentEmissive.EmissiveParts != null && LastEmissive.EmissiveParts != null && currentEmissive.CurrentPart == LastEmissive.CurrentPart && currentEmissive.CurrentColor == LastEmissive.CurrentColor && Math.Abs(currentEmissive.CurrentIntensity - LastEmissive.CurrentIntensity) < 0.001) { currentEmissive = new EmissiveState(); } LastEmissive = currentEmissive; if (currentEmissive.EmissiveParts != null && currentEmissive.EmissiveParts.Length > 0) { if (currentEmissive.CycleParts) { animation.Part.SetEmissiveParts(currentEmissive.EmissiveParts[currentEmissive.CurrentPart], currentEmissive.CurrentColor, currentEmissive.CurrentIntensity); if (!currentEmissive.LeavePreviousOn) { var prev = currentEmissive.CurrentPart - 1 >= 0 ? currentEmissive.CurrentPart - 1 : currentEmissive.EmissiveParts .Length - 1; animation.Part.SetEmissiveParts(currentEmissive.EmissiveParts[prev], Color.Transparent, 0); } } else { for (int j = 0; j < currentEmissive.EmissiveParts.Length; j++) { animation.Part.SetEmissiveParts(currentEmissive.EmissiveParts[j], currentEmissive.CurrentColor, currentEmissive.CurrentIntensity); } } } } } }
internal void GetCurrentMove(out Vector3D translation, out Matrix rotation, out Matrix rotAroundCenter, out AnimationType type, out EmissiveState emissiveState) { type = TypeSet[MoveToSetIndexer[_currentMove][(int)Indexer.TypeIndex]]; var moveSet = System.WeaponLinearMoveSet[AnimationId]; if (type == AnimationType.Movement) { if (moveSet[MoveToSetIndexer[_currentMove][(int)Indexer.MoveIndex]] != Matrix.Zero) { translation = moveSet[MoveToSetIndexer[_currentMove][(int)Indexer.MoveIndex]].Translation; } else { translation = Vector3D.Zero; } rotation = RotationSet[MoveToSetIndexer[_currentMove][(int)Indexer.RotationIndex]]; rotAroundCenter = RotCenterSet[MoveToSetIndexer[_currentMove][(int)Indexer.RotCenterIndex]]; } else { translation = Vector3D.Zero; rotation = Matrix.Zero; rotAroundCenter = Matrix.Zero; } if (System.WeaponEmissiveSet.TryGetValue(EmissiveIds[MoveToSetIndexer[_currentMove][(int)Indexer.EmissiveIndex]], out emissiveState)) { emissiveState.CurrentPart = CurrentEmissivePart[MoveToSetIndexer[_currentMove][(int)Indexer.EmissivePartIndex]]; if (emissiveState.EmissiveParts != null && LastEmissive.EmissiveParts != null && emissiveState.CurrentPart == LastEmissive.CurrentPart && emissiveState.CurrentColor == LastEmissive.CurrentColor && Math.Abs(emissiveState.CurrentIntensity - LastEmissive.CurrentIntensity) < 0.001) { emissiveState = new EmissiveState(); } LastEmissive = emissiveState; } else { emissiveState = LastEmissive = new EmissiveState(); } }