コード例 #1
0
        SpecialNode CreateTailNode(int x, int y)
        {
            SpecialNode s = new SpecialNode();

            s.node = GetNode(x, y);
            s.obj  = new GameObject();
            s.obj.transform.parent     = tailParent.transform;
            s.obj.transform.position   = s.node.worldPosition;
            s.obj.transform.localScale = Vector3.one * .7f;
            SpriteRenderer r = s.obj.AddComponent <SpriteRenderer>();

            r.sprite       = playerSprite;
            r.sortingOrder = 1;



            return(s);
        }
コード例 #2
0
        void MoveTail()
        {
            Node prevNode = null;

            for (int i = 0; i < tail.Count; i++)
            {
                SpecialNode p = tail[i];
                availableNodes.Add(p.node);
                if (i == 0)
                {
                    prevNode = p.node;
                    p.node   = playerNode;
                }
                else
                {
                    Node prev = p.node;
                    p.node   = prevNode;
                    prevNode = prev;
                }
                availableNodes.Remove(p.node);
                PlacePlayerObject(p.obj, p.node.worldPosition);
            }
        }