Пример #1
0
        public override void DoAction(Timeline timeline)
        {
            oldBehavior = new List <TargetBehavior>();

            affectedTargets.ForEach(targetData => {
                TargetVelocity velocity = TargetVelocity.None;

                if (newBehavior == TargetBehavior.ChainStart)
                {
                    velocity = TargetVelocity.ChainStart;
                }
                else if (newBehavior == TargetBehavior.Chain)
                {
                    velocity = TargetVelocity.Chain;
                }
                else if (newBehavior == TargetBehavior.Melee)
                {
                    velocity = TargetVelocity.Melee;
                }
                else if (newBehavior == TargetBehavior.Mine)
                {
                    velocity = TargetVelocity.Mine;
                }
                else if (newBehavior == TargetBehavior.Standard ||
                         newBehavior == TargetBehavior.Hold ||
                         newBehavior == TargetBehavior.Horizontal ||
                         newBehavior == TargetBehavior.Vertical)
                {
                    velocity = TargetVelocity.Standard;
                }

                //Path notes and regular notes both use the same beat length
                oldBeatLength.Add(targetData.beatLength);

                if (targetData.behavior == TargetBehavior.NR_Pathbuilder)
                {
                    oldBehavior.Add(targetData.pathBuilderData.behavior);
                    oldHandTypes.Add(targetData.pathBuilderData.handType);
                    oldVelocities.Add(targetData.pathBuilderData.velocity);

                    targetData.pathBuilderData.behavior = newBehavior;
                    if (velocity != TargetVelocity.None)
                    {
                        targetData.pathBuilderData.velocity = velocity;
                    }

                    //Fix hand type when going to melee
                    if (newBehavior == TargetBehavior.Melee)
                    {
                        targetData.pathBuilderData.handType = TargetHandType.Either;
                    }

                    //Fixup hand type when coming from melee
                    if (oldBehavior.Last() == TargetBehavior.Melee)
                    {
                        targetData.pathBuilderData.handType = targetData.handType;
                    }

                    ChainBuilder.ChainBuilder.GenerateChainNotes(targetData);
                }
                else
                {
                    oldBehavior.Add(targetData.behavior);
                    oldHandTypes.Add(targetData.handType);
                    oldVelocities.Add(targetData.velocity);

                    targetData.behavior = newBehavior;
                    if (velocity != TargetVelocity.None)
                    {
                        targetData.velocity = velocity;
                    }

                    //Fix hand type when going to melee
                    if (newBehavior == TargetBehavior.Melee)
                    {
                        targetData.handType = TargetHandType.Either;
                    }

                    //Fixup hand type when coming from melee
                    if (oldBehavior.Last() == TargetBehavior.Melee)
                    {
                        targetData.handType = TargetHandType.Left;
                    }

                    if (TargetData.BehaviorSupportsBeatLength(newBehavior) && targetData.beatLength < Constants.QuarterNoteDuration)
                    {
                        targetData.beatLength = Constants.QuarterNoteDuration;
                    }
                }
            });
        }