Esempio n. 1
0
    void Die()
    {
        // Sets all to 0
        pointCounter   = 0;
        foodCount.text = pointCounter.ToString();
        bodyInfo.speed = Tail.initialSpeed;

        // Creates a New Map
        mapInfo.SetupMap();

        TilesGrid grid = mapInfo.gridGen.gridData;

        // Move snake to center
        if (grid != null)
        {
            bodyInfo.currentNode = grid.centerNode;
            bodyInfo.nextNode    = null;
            bodyInfo.lastNode    = null;

            transform.position = grid.NodeWorldPos(grid.centerNode);
        }
        else
        {
            Debug.LogError("Tail::Start -- GRID NOT CREATED YET");
        }
    }
Esempio n. 2
0
 void Start()
 {
     if (!isHead)
     {
         nextDirection = parentTailScript.currentDirection;
         nextNode      = parentTailScript.currentNode;
     }
     else
     {
         if (grid != null)
         {
             currentNode        = grid.centerNode;
             transform.position = grid.NodeWorldPos(grid.centerNode);
         }
         else
         {
             Debug.LogError("Tail::Start -- GRID NOT CREATED YET");
         }
     }
 }