public void ChangeColor(AnimationLayers color) { int possibleColors = System.Enum.GetValues(typeof(AnimationLayers)).Length; // if getting an unkown color, choose one at random, excluding grey if ((int)color >= possibleColors) { color = (AnimationLayers)Random.Range(1, possibleColors); // Supporting.Log("using random color: " + color.ToString(), 2); } // loop through animation layers activating the one that corresponded to the current powerUp and deactivating the rest for (int i = 0; i < possibleColors; i++) { if (i == (int)color) { _animator.SetLayerWeight(i, 1); } else { _animator.SetLayerWeight(i, 0); } } ChangeParticlesColor(color); }
public static AnimationVisualFeedbackPlayAsyncEvent alloc(AnimationVisualFeedback p_animationVisualFeedback, AnimationLayers p_layerID, IAnimationInput p_animationInput) { AnimationVisualFeedbackPlayAsyncEvent l_instance = new AnimationVisualFeedbackPlayAsyncEvent(); l_instance.AnimationVisualFeedback = p_animationVisualFeedback; l_instance.LayerID = p_layerID; l_instance.AnimationInput = p_animationInput; return(l_instance); }
public void RemoveAnimsWithDeadReferenceWeights() { lock (_lock_AnimationLayers) { var layersToClear = new List <NewHavokAnimation>(); for (int i = 0; i < AnimationLayers.Count - 1; i++) { var layer = AnimationLayers[i]; if (layer.ReferenceWeight < 0.001f) { layersToClear.Add(layer); } } foreach (var layer in layersToClear) { AnimationLayers.Remove(layer); } } }
public static AnimationVisualFeedbackDestroyLayerEvent alloc(AnimationVisualFeedback p_animationVisualFeedback, AnimationLayers p_layerID) { AnimationVisualFeedbackDestroyLayerEvent l_instance = new AnimationVisualFeedbackDestroyLayerEvent(); l_instance.AnimationVisualFeedback = p_animationVisualFeedback; l_instance.LayerID = p_layerID; return(l_instance); }
private void ChangeParticlesColor(AnimationLayers color) { ParticleSystem.ColorOverLifetimeModule colorOverLifetime = _particles.colorOverLifetime; colorOverLifetime.enabled = true; Color32 newColor; switch (color) { case AnimationLayers.Grey: default: { newColor = _grey; break; } case AnimationLayers.Red: { newColor = _red; break; } case AnimationLayers.Yellow: { newColor = _yellow; break; } case AnimationLayers.Green: { newColor = _green; break; } case AnimationLayers.Blue: { newColor = _blue; break; } case AnimationLayers.Purple: { newColor = _purple; break; } case AnimationLayers.Pink: { newColor = _pink; break; } } Gradient gradient = new Gradient(); gradient.SetKeys(new GradientColorKey[] { new GradientColorKey(newColor, 0.5f), new GradientColorKey(Color.white, 1.0f) }, new GradientAlphaKey[] { new GradientAlphaKey(1.0f, 0.5f), new GradientAlphaKey(1.0f, 1.0f) }); colorOverLifetime.color = gradient; }