コード例 #1
0
        public override PatternActionResult Invoke(long time, PatternContext context)
        {
            if (State != PatternActionState.Enabled)
            {
                return(PatternActionResult.DoNothing);
            }

            var anchorTimes = context.GetAnchorTimes(Anchor);
            var newTime     = 0L;

            switch (AnchorPosition)
            {
            case AnchorPosition.First:
                newTime = anchorTimes.First();
                break;

            case AnchorPosition.Last:
                newTime = anchorTimes.Last();
                break;

            case AnchorPosition.Nth:
                newTime = anchorTimes[Index];
                break;
            }

            return(new PatternActionResult(newTime));
        }
コード例 #2
0
ファイル: MoveToAnchorAction.cs プロジェクト: Hyuan02/GGJ2020
        public PatternActionResult Invoke(long time, PatternContext context)
        {
            var anchorTimes = context.GetAnchorTimes(Anchor);
            var newTime     = 0L;

            switch (AnchorPosition)
            {
            case AnchorPosition.First:
                newTime = anchorTimes.First();
                break;

            case AnchorPosition.Last:
                newTime = anchorTimes.Last();
                break;

            case AnchorPosition.Nth:
                newTime = anchorTimes[Index];
                break;
            }

            return(new PatternActionResult(newTime));
        }