void move_next()
 {
     CFG.Anchor        = NextNode.ToWayPoint();
     CFG.Anchor.Radius = C.NodeTargetRange;
     SetTarget(CFG.Anchor);
     stage = Stage.MoveNext;
 }
        public override void Move()
        {
            this.Stop();
            if (CanMove())
            {
                if (lastBaggage != null)
                {
                    NextNode.PassBaggage(lastBaggage);
                }

                for (int index = conveyorBelt.Length - 1; index > 0; index--)
                {
                    conveyorBelt[index]     = conveyorBelt[index - 1];
                    conveyorBelt[index - 1] = null;
                }
            }
            else
            {
                NextNode.OnNodeStatusChangedToFree += Move;
                return;
            }

            NextNode.OnNodeStatusChangedToFree -= Move;
            Status = BaggageStatus.Free;
            this.Start();
        }
Exemple #3
0
        public CCPoint GetWorldPosition(float hexRadius, float hexMargin)
        {
            var startPos   = CurrentNode.GetWorldPosition(hexRadius, hexMargin);
            var nextPos    = NextNode.GetWorldPosition(hexRadius, hexMargin);
            var deltaPos   = nextPos - startPos;
            var interpoled = deltaPos * Progress;

            return(startPos + interpoled);
        }
Exemple #4
0
    public void Print()
    {
        Console.Write("|" + this.Data + "|-> ");

        if (this.NextNode != null)
        {
            NextNode.Print();
        }
    }
Exemple #5
0
            public void ExtractAssignment(IList <uint> colors)
            {
                for (int i = Start; i < End; i++)
                {
                    colors[i] = color;
                }

                NextNode.ExtractAssignment(colors);
            }
Exemple #6
0
        public override bool ProcessNode(int amount)
        {
            int processableAmount = amount % 500;

            if (processableAmount > 0)
            {
                return(NextNode != null?NextNode.ProcessNode(processableAmount) :  false);
            }
            return(true);
        }
Exemple #7
0
        public bool ProcessNode2(int amount)
        {
            int processableAmount = amount % Denomination;

            if (processableAmount > 0)
            {
                return(NextNode.ProcessNode(processableAmount));
            }
            return(true);
        }
Exemple #8
0
 public void SetNextDestination()
 {
     Destination = NextNode.GetNodeDirection(NavNode.NodeType.Door, doorsVisited);
     if (Destination == null)
     {
         doorsVisited = new List <NavNode>();
         Destination  = NextNode.GetNodeDirection(NavNode.NodeType.Door, doorsVisited);
     }
     SetNextNode();
 }
Exemple #9
0
        public override bool ProcessNode(int amount)
        {
            int processableAmount = amount % 2000;

            if (processableAmount > 0)
            {
                return(NextNode.ProcessNode(processableAmount));
            }

            return(true);
        }
Exemple #10
0
 public void AddNode(IUIBinder binder)
 {
     if (NextNode == null)
     {
         NextNode = new UIBinderProxy(binder);
     }
     else
     {
         NextNode.AddNode(binder);
     }
 }
Exemple #11
0
 public void AddNode(ILinkedListNode <string> node)
 {
     if (NextNode == null)
     {
         NextNode = node;
     }
     else
     {
         NextNode.AddNode(node);
     }
 }
Exemple #12
0
 public void RemoveNode(string identify)
 {
     if (NextNode.Identify == identify)
     {
         NextNode = null;
     }
     else
     {
         NextNode.RemoveNode(identify);
     }
 }
        public override void PrintTrees(int depth)
        {
            for (int i = 0; i < depth; i++)
            {
                Console.Write("\t");
            }
            Console.WriteLine($"{this.GetType()}");

            Action.PrintTrees(depth + 1);
            NextNode?.PrintTrees(depth + 1);
        }
Exemple #14
0
 public void AddToEnd(int Data)
 {
     if (NextNode == null)
     {
         NextNode = new Node(Data);
     }
     else
     {
         NextNode.AddToEnd(Data);
     }
 }
Exemple #15
0
            public void ExtractAssignment(IList <uint> colors)
            {
                for (int i = Start; i < End; i++)
                {
                    colors[i] = ColorSpace.Empty;
                }

                if (NextNode != null)
                {
                    NextNode.ExtractAssignment(colors);
                }
            }
 public void Push(StatementAstNode item)
 {
     if (NextNode == null)
     {
         NextNode = item;
         Children.Add(item);
     }
     else
     {
         NextNode.Push(item);
     }
 }
Exemple #17
0
 private void Move()
 {
     if (NextNode.NodeStatus == NodeStatus.Free)
     {
         NextNode.PassBaggage(currentBag);
         NextNode.OnNodeStatusChangedToFree -= Move;
         NodeStatus = NodeStatus.Free;
     }
     else
     {
         NextNode.OnNodeStatusChangedToFree -= Move;
         NextNode.OnNodeStatusChangedToFree += Move;
     }
 }
Exemple #18
0
            public bool Reset(IBoardView boardView)
            {
                Start = PrevNode != null ? PrevNode.End : 0;

                if (NextNode == null)
                {
                    return(Verify(boardView));
                }
                else
                {
                    End = MinEnd;
                }

                return(NextNode.Reset(boardView));
            }
Exemple #19
0
 public void HandleEvent(EventArgs args)
 {
     if (string.IsNullOrEmpty(args.Performer as string) || args.Performer as string == Identify)
     {
         Handlers[args.Token].Invoke(args);
     }
     if (args.Performer as string == Identify || args.Handled == true)
     {
         return;
     }
     if (NextNode != null)
     {
         NextNode.HandleEvent(args);
     }
 }
Exemple #20
0
 public override void ProcessBaggage()
 {
     if (NextNode.Status == BaggageStatus.Free)
     {
         NextNode.PassBaggage(baggage);
         Status = BaggageStatus.Free;
         if (baggageInCheckIn == 1)
         {
             startOfBaggageTransfer = DateTime.Now;
         }
         NextNode.OnNodeStatusChangedToFree -= ProcessBaggage;
     }
     else
     {
         NextNode.OnNodeStatusChangedToFree += ProcessBaggage;
     }
 }
Exemple #21
0
        public void Draw(SpriteBatch spriteBatch, Vector2 tileSizeVector)
        {
            var translation = Globals.DefaultTranslation;

            var rotation = 0f;

            if (Direction == Directions.Down)
            {
                rotation = 90;
            }
            else if (Direction == Directions.Left)
            {
                rotation = 180;
            }
            else if (Direction == Directions.Up)
            {
                rotation = 270;
            }

            if (rotation > 0)
            {
                translation  = Matrix.CreateTranslation(-16, -16, 0);
                translation *= Matrix.CreateRotationZ(MathHelper.ToRadians(rotation));
                translation *= Matrix.CreateTranslation(16, 16, 0);
                translation *= Globals.DefaultTranslation;
            }


            var pos = Position * tileSizeVector - new Vector2(16);

            translation *= Matrix.CreateTranslation(pos.X, pos.Y, 0);

            spriteBatch.Begin(transformMatrix: translation);


            _pacmanSprite.Draw(spriteBatch, Vector2.Zero);

            spriteBatch.End();

            spriteBatch.Begin();

            spriteBatch.DrawString(_font, NextNode.ToString(), new Vector2(10, 20), Color.Red);

            spriteBatch.End();
        }
Exemple #22
0
        public void Delete(string search, string path, int pos = 0, string debugging = "")
        {
            TraversalOption nextStep = new TraversalOption(Label, search, pos);

            switch (nextStep.option)
            {
            case TraversalOptions.MoveNext:
                if (NextNode == null)
                {
                    return;
                }
                NextNode.Delete(search, path, pos);
                break;

            case TraversalOptions.MoveDown:
                if (ChildNode != null)
                {
                    ChildNode.Delete(search, path, pos + nextStep.commonPrefixLength, debugging + Label);
                    Results.Remove(item => item.ComparePath(path));
                    if (Results.Count == StaticVariables.ResultListLength - 1)
                    {
                        RefillResults();
                    }
                    if (Results.Count == 0 && NextNode != null)
                    {
                        Items     = NextNode.Items;
                        Results   = NextNode.Results;
                        Label     = NextNode.Label;
                        ChildNode = NextNode.ChildNode;
                        NextNode  = NextNode.NextNode;
                    }
                }
                break;

            case TraversalOptions.Found:
                Items.Where(item => item.ComparePath(path)).ToList().ForEach(item => item.Delete());
                Items.RemoveAll(item => item.ComparePath(path));
                ResultItems.RemoveAll(item => item.ComparePath(path));
                break;

            default:
                return;
            }
        }
Exemple #23
0
        /// <summary>
        /// コメントからPVを探します。
        /// </summary>
        public void SetupPVInfo(Board board)
        {
            Move move = null;

            if (VariationNode != null)
            {
                VariationNode.SetupPVInfo(board);
            }

            // このノードの手を指して、変化の基準局面を進めます。
            if (LiteralMove != null && LiteralMove.Validate())
            {
                move = MakeMove(board, new List <Exception>());
                if (move == null || !move.Validate())
                {
                    Log.Error("'{0}'が正しく着手できません。", move);
                    return;
                }
            }

            for (var i = 0; i < CommentList.Count();)
            {
                var pvInfo = ParsePVInfo(CommentList[i], board);
                if (pvInfo != null)
                {
                    PVInfoList.Add(pvInfo);
                    CommentList.RemoveAt(i);
                }
                else
                {
                    ++i;
                }
            }

            if (NextNode != null)
            {
                NextNode.SetupPVInfo(board);
            }

            if (move != null)
            {
                board.Undo();
            }
        }
 void search_for_next()
 {
     //move to flattest node if it is flatter than those we've already checked
     NextNode = FlattestNode;
     if (FlattestNode != null &&
         (FlattestNodeTired == null ||
          FlattestNodeTired.unevenness > NextNode.unevenness &&
          NextNode.DistanceTo(VSL) / VSL.Geometry.R > C.NodeTargetRange * 2))
     {
         FlattestNodeTired = NextNode;
         WideCheckAlt     += C.WideCheckAltitude *
                             (float)(NextNode.unevenness / C.MaxUnevenness);
         move_next();
     }
     else
     {
         wide_check(C.WideCheckAltitude);
     }
 }
 public override void ProcessBaggage()
 {
     if (NextNode.Status == BaggageStatus.Free)
     {
         if (baggage.Secure == 2 || baggage.Secure == 7)
         {
             baggageAgainstSecurityPolicy.Enqueue(baggage);
             NextNode.OnNodeStatusChangedToFree -= ProcessBaggage;
         }
         else
         {
             NextNode.PassBaggage(baggage);
             NextNode.OnNodeStatusChangedToFree -= ProcessBaggage;
         }
     }
     else
     {
         NextNode.OnNodeStatusChangedToFree += ProcessBaggage;
     }
     Status = BaggageStatus.Free;
 }
Exemple #26
0
            private bool MoveWorker(int minStartVal, IBoardView boardView)
            {
                Start = minStartVal;

                while (End <= max)
                {
                    if (Verify(boardView))
                    {
                        if (PrevNode.VerifyNextMoved(boardView))
                        {
                            if (NextNode.Reset(boardView))
                            {
                                return(true);
                            }
                        }
                    }

                    Start++;
                }

                return(false);
            }
Exemple #27
0
        public SearchNode Find(string search, int pos = 0)
        {
            TraversalOption nextStep = new TraversalOption(Label, search, pos);

            switch (nextStep.option)
            {
            case TraversalOptions.Split:
                return((nextStep.commonPrefixLength + pos == search.Length) ? this : null);

            case TraversalOptions.Found:
                return(this);

            case TraversalOptions.MoveNext:
                return(NextNode?.Find(search, pos));

            case TraversalOptions.MoveDown:
                return(ChildNode?.Find(search, pos + nextStep.commonPrefixLength));

            default:
                return(null);
            }
        }
Exemple #28
0
        /// <summary>
        /// ノード全体を文字列化します。
        /// </summary>
        private void MakeString(StringBuilder sb, int nmoves)
        {
            if (Move != null)
            {
                var str    = Move.ToString();
                var hanlen = str.HankakuLength();

                sb.AppendFormat(" - {0}{1}",
                                str, new string(' ', Math.Max(0, 14 - hanlen)));
            }

            if (NextNode != null)
            {
                NextNode.MakeString(sb, nmoves + 1);
            }

            for (var i = 1; i < NextNodes.Count(); ++i)
            {
                sb.AppendLine();
                sb.Append(new string(' ', 17 * nmoves));

                NextNodes[i].MakeString(sb, nmoves);
            }
        }
Exemple #29
0
 void SetNextDestination()
 {
     if (!InGroup)
     {
         if (currentState == State.Normal)
         {
             destination = NextNode.GetNodeDirection(NavNode.NodeType.Door, doorsVisited);
             if (destination == null)
             {
                 doorsVisited = new List <NavNode>();
                 destination  = NextNode.GetNodeDirection(NavNode.NodeType.Door, doorsVisited);
             }
             SetNextNode();
         }
         else
         {
             //todo
         }
     }
     else
     {
         group.SetNextDestination();
     }
 }
Exemple #30
0
        /// <summary>
        /// Sets the specified element in the current random access list to the
        /// specified value.
        /// </summary>
        /// <param name="value">
        /// The new value for the specified element.
        /// </param>
        /// <param name="index">
        /// An integer that represents the position of the random access list
        /// element to set.
        /// </param>
        /// <returns>
        /// A new random access list top node with the element at the specified
        /// position set to the specified value.
        /// </returns>
        public RalTopNode SetValue(object value, int index)
        {
            RalTopNode result;

            // If the element is in the tree represented by the current top
            // node.
            if (index < Root.Count)
            {
                // Descend into the tree.
                result = new RalTopNode(
                    root.SetValue(value, index),
                    NextNode);
            }
            // Else the element is further along in the list.
            else
            {
                // Move to the next top node.
                result = new RalTopNode(
                    root,
                    NextNode.SetValue(value, index - Root.Count));
            }

            return(result);
        }
Exemple #31
0
    public LineSegment(GameObject start, GameObject end)
    {
        StartNodeGO = start;
        EndNodeGO = end;

        StartNodeScript = start.GetComponent<NextNode>();
        EndNodeScript = end.GetComponent<NextNode>();

        StartPos = new Vector2(start.transform.position.x, start.transform.position.y);
        EndPos = new Vector2(end.transform.position.x, end.transform.position.y);

        if (parent == null)
        {
            parent = new GameObject("[DEBUG] Line segment parent").transform;
        }

        GameObject line = new GameObject(this.StartNodeGO.name + " to " + this.EndNodeGO.name);
        line.transform.parent = parent;
        DebugLine = line.AddComponent<LineRenderer>();
        DebugLine.SetWidth(0.05f, 0.05f);
        DebugLine.SetPosition(0, new Vector3(this.StartPos.x, this.StartPos.y, -1));
        DebugLine.SetPosition(1, new Vector3(this.EndPos.x, this.EndPos.y, -1));
    }