/// <summary>Called when an avaible spot is found in change form controller. /// Updates the state and plays the sound. /// Starts chaning the mesh</summary> private void OnAvailableSpotFound() { ShapeData prevData = GetCurrentState(); ShapeData data = SkillData.GetData(curAttemptedStateIndex); // If the direction affects how the shape scales or we are swapping to a new state if (data.DirectionAffectsScale || !IsCurrentState(curAttemptedStateIndex)) { // Update the state UpdateCurrentState(curAttemptedStateIndex); // Start changing shape if we need to if (data.TypeOfShape != curShape) { // Start updating the mesh meshTransitioner.StartChangeShape(data.TypeOfShape); // Check if we need to invoke the shape change behaviors if (prevData.HasShapeChangeBehavior) { // Call change from on the old data prevData.ShapeChangeBehave.ChangeFrom(); } if (data.HasShapeChangeBehavior) { // Call change to on the new data data.ShapeChangeBehave.ChangeTo(); } } // Set the current shape to the new one curShape = data.TypeOfShape; } }
/// <summary>Start changing to the given shape.</summary> /// <param name="shapeToChangeTo">Shape to change to.</param> protected override void ChangeStateCall(ShapeData.ShapeType shapeToChangeTo) { blendTransitioner.StartChangeShape(shapeToChangeTo, ChangeAfterDelay); }