Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <summary>
- /// This takes the property/trick you want to play (imagine the skater is in standard footing, non-switch), converts it to the property appropriate
- /// for current stance, then plays that instead. It plays the motion you naively expect, which internally depends on stance/direction/etc.
- /// </summary>
- /// <param name="propertyName">the property name associated with the trick anim you want to play.</param>
- public void PlayTrickAnim(string propertyName)
- {
- // We store both original property name, AND the name we convert that into, for later clearing
- if (!trickAnimProperties.Contains(propertyName)) { trickAnimProperties.Add(propertyName); }
- // Now, mirror the movements front/back as appropriate.
- string newPropertyName = propertyName;
- string[] propertyTokens = newPropertyName.Split('_');
- if (InSwitch)
- {
- if (propertyTokens[propertyTokens.Length -1] == "left") { propertyTokens[propertyTokens.Length - 1] = "right"; }
- else if (propertyTokens[propertyTokens.Length - 1] == "right") { propertyTokens[propertyTokens.Length - 1] = "left"; }
- }
- if (goofyStance)
- {
- if (propertyTokens[propertyTokens.Length - 1] == "left") { propertyTokens[propertyTokens.Length - 1] = "right"; }
- else if (propertyTokens[propertyTokens.Length - 1] == "right") { propertyTokens[propertyTokens.Length - 1] = "left"; }
- }
- newPropertyName = propertyTokens[0];
- for (int index = 1; index < propertyTokens.Length; index++)
- {
- newPropertyName += "_" + propertyTokens[index];
- }
- // (we gotta store both, to clear this properly, because of how you can enter switch state at or before the end of a trick, meaning we can't rely on current state telling us what anim was played)
- if (!trickAnimProperties.Contains(newPropertyName)) { trickAnimProperties.Add(newPropertyName); }
- // Now, apply the animation!
- character.SetBool(newPropertyName, true);
- }
Advertisement
Add Comment
Please, Sign In to add comment