void Start() { if (profile == null) { profile = GetComponent <LegFingersProfiler>(); } left = new FootAction(profile.left); right = new FootAction(profile.right); current = left; _animator = Util.FindComponent <Animator>(transform); }
public void SwitchFoot() { current = current == left? right: left; }
public FootArrowState(StepType step, FootAction action) { Step = step; Action = action; Valid = true; }
/// <summary> /// Static initializer. /// </summary> static StepData() { // Initialize StateAfterAction. var footActions = Enum.GetValues(typeof(FootAction)).Cast <FootAction>().ToList(); StateAfterAction = new GraphArrowState[footActions.Count]; StateAfterAction[(int)FootAction.Tap] = GraphArrowState.Resting; StateAfterAction[(int)FootAction.Hold] = GraphArrowState.Held; StateAfterAction[(int)FootAction.Release] = GraphArrowState.Resting; // Create lists of combinations of actions for each number of foot portions. // Create one list with releases and one without. var actionCombinations = new FootAction[NumFootPortions][][]; var actionCombinationsWithoutReleases = new FootAction[NumFootPortions][][]; for (var i = 0; i < NumFootPortions; i++) { var combinations = Combinations.CreateCombinations <FootAction>(i + 1); // For brackets you can never release and place at the same time // This would be split into two events, a release first, and a step after. // Prune those combinations out now so we don't loop over them and need to check for them // when searching. if (i >= 1) { combinations.RemoveAll(actions => { var hasAtLeastOneRelease = false; var isAllReleases = true; foreach (var action in actions) { if (action == FootAction.Release) { hasAtLeastOneRelease = true; } else { isAllReleases = false; } } return(hasAtLeastOneRelease != isAllReleases); }); } actionCombinations[i] = combinations.ToArray(); // Update the combinations with no releases. combinations.RemoveAll(actions => { foreach (var action in actions) { if (action == FootAction.Release) { return(true); } } return(false); }); actionCombinationsWithoutReleases[i] = combinations.ToArray(); } var steps = Enum.GetValues(typeof(StepType)).Cast <StepType>().ToList(); // Set up swap data arrays for legibility below. var noFootSwap = new bool[NumFootPortions]; var defaultFootSwap = new bool[NumFootPortions]; var heelFootSwap = new bool[NumFootPortions]; var toeFootSwap = new bool[NumFootPortions]; for (var p = 0; p < NumFootPortions; p++) { noFootSwap[p] = false; defaultFootSwap[p] = p == DefaultFootPortion; heelFootSwap[p] = p == Heel; toeFootSwap[p] = p == Toe; } // Configure the Steps. Steps = new StepData[steps.Count]; Steps[(int)StepType.SameArrow] = new StepData( actionSets: actionCombinations[0], footPortionsForStep: new[] { DefaultFootPortion }, canBeUsedInJump: true, isFootSwap: noFootSwap, isBracket: false, onlyConsiderCurrentArrowsWhenFilling: true ); Steps[(int)StepType.NewArrow] = new StepData( actionSets: actionCombinationsWithoutReleases[0], footPortionsForStep: new[] { DefaultFootPortion }, canBeUsedInJump: true, isFootSwap: noFootSwap, isBracket: false, onlyConsiderCurrentArrowsWhenFilling: false ); Steps[(int)StepType.CrossoverFront] = new StepData( actionSets: actionCombinationsWithoutReleases[0], footPortionsForStep: new[] { DefaultFootPortion }, canBeUsedInJump: false, isFootSwap: noFootSwap, isBracket: false, onlyConsiderCurrentArrowsWhenFilling: false ); Steps[(int)StepType.CrossoverBehind] = new StepData( actionSets: actionCombinationsWithoutReleases[0], footPortionsForStep: new[] { DefaultFootPortion }, canBeUsedInJump: false, isFootSwap: noFootSwap, isBracket: false, onlyConsiderCurrentArrowsWhenFilling: false ); Steps[(int)StepType.InvertFront] = new StepData( actionSets: actionCombinationsWithoutReleases[0], footPortionsForStep: new[] { DefaultFootPortion }, canBeUsedInJump: false, isFootSwap: noFootSwap, isBracket: false, onlyConsiderCurrentArrowsWhenFilling: false ); Steps[(int)StepType.InvertBehind] = new StepData( actionSets: actionCombinationsWithoutReleases[0], footPortionsForStep: new[] { DefaultFootPortion }, canBeUsedInJump: false, isFootSwap: noFootSwap, isBracket: false, onlyConsiderCurrentArrowsWhenFilling: false ); Steps[(int)StepType.FootSwap] = new StepData( actionSets: actionCombinationsWithoutReleases[0], footPortionsForStep: new[] { DefaultFootPortion }, canBeUsedInJump: false, isFootSwap: defaultFootSwap, isBracket: false, onlyConsiderCurrentArrowsWhenFilling: false ); Steps[(int)StepType.BracketHeelNewToeNew] = new StepData( actionSets: actionCombinationsWithoutReleases[1], footPortionsForStep: new[] { Heel, Toe }, canBeUsedInJump: true, isFootSwap: noFootSwap, isBracket: true, onlyConsiderCurrentArrowsWhenFilling: false ); Steps[(int)StepType.BracketHeelNewToeSame] = new StepData( actionSets: actionCombinationsWithoutReleases[1], footPortionsForStep: new[] { Heel, Toe }, canBeUsedInJump: true, isFootSwap: noFootSwap, isBracket: true, onlyConsiderCurrentArrowsWhenFilling: false ); Steps[(int)StepType.BracketHeelSameToeNew] = new StepData( actionSets: actionCombinationsWithoutReleases[1], footPortionsForStep: new[] { Heel, Toe }, canBeUsedInJump: true, isFootSwap: noFootSwap, isBracket: true, onlyConsiderCurrentArrowsWhenFilling: false ); Steps[(int)StepType.BracketHeelSameToeSame] = new StepData( actionSets: actionCombinations[1], footPortionsForStep: new[] { Heel, Toe }, canBeUsedInJump: true, isFootSwap: noFootSwap, isBracket: true, onlyConsiderCurrentArrowsWhenFilling: true ); Steps[(int)StepType.BracketHeelSameToeSwap] = new StepData( actionSets: actionCombinationsWithoutReleases[1], footPortionsForStep: new[] { Heel, Toe }, canBeUsedInJump: false, isFootSwap: toeFootSwap, isBracket: true, onlyConsiderCurrentArrowsWhenFilling: false ); Steps[(int)StepType.BracketHeelNewToeSwap] = new StepData( actionSets: actionCombinationsWithoutReleases[1], footPortionsForStep: new[] { Heel, Toe }, canBeUsedInJump: false, isFootSwap: toeFootSwap, isBracket: true, onlyConsiderCurrentArrowsWhenFilling: false ); Steps[(int)StepType.BracketHeelSwapToeSame] = new StepData( actionSets: actionCombinationsWithoutReleases[1], footPortionsForStep: new[] { Heel, Toe }, canBeUsedInJump: false, isFootSwap: heelFootSwap, isBracket: true, onlyConsiderCurrentArrowsWhenFilling: false ); Steps[(int)StepType.BracketHeelSwapToeNew] = new StepData( actionSets: actionCombinationsWithoutReleases[1], footPortionsForStep: new[] { Heel, Toe }, canBeUsedInJump: false, isFootSwap: heelFootSwap, isBracket: true, onlyConsiderCurrentArrowsWhenFilling: false ); Steps[(int)StepType.BracketOneArrowHeelSame] = new StepData( actionSets: actionCombinations[0], footPortionsForStep: new[] { Heel }, canBeUsedInJump: true, isFootSwap: noFootSwap, isBracket: false, onlyConsiderCurrentArrowsWhenFilling: true ); Steps[(int)StepType.BracketOneArrowHeelNew] = new StepData( actionSets: actionCombinationsWithoutReleases[0], footPortionsForStep: new[] { Heel }, canBeUsedInJump: true, isFootSwap: noFootSwap, isBracket: false, onlyConsiderCurrentArrowsWhenFilling: false ); Steps[(int)StepType.BracketOneArrowToeSame] = new StepData( actionSets: actionCombinations[0], footPortionsForStep: new[] { Toe }, canBeUsedInJump: true, isFootSwap: noFootSwap, isBracket: false, onlyConsiderCurrentArrowsWhenFilling: true ); Steps[(int)StepType.BracketOneArrowToeNew] = new StepData( actionSets: actionCombinationsWithoutReleases[0], footPortionsForStep: new[] { Toe }, canBeUsedInJump: true, isFootSwap: noFootSwap, isBracket: false, onlyConsiderCurrentArrowsWhenFilling: false ); }