Esempio n. 1
0
    // Start is called before the first frame update
    void Start()
    {
        snakeController = this.transform.parent.gameObject.GetComponent <SnakePart>();
        if (snakeController == null)
        {
            Debug.Log("No snake");
            Destroy(this);
        }
        else
        {
            snakeController.speed = initialSpeed;
        }
        getGrid();
        //Initialise grid
        //Grid(Vector3 c, Vector3 g, List<Boundary> b)



        //Set the initial Direction
        direction        = new Vector3(0, 0, 1);
        currentGridPoint = this.transform.position + (direction * grid.gridSpacing.z);
        snakeController.UpdateWayPoints(currentGridPoint);
        //Should probably do this based on which direction is forward
        //gridTest();
    }
Esempio n. 2
0
 private void snakeBody(Vector3 nextGridPoint)
 {
     //sends information on  the new waypoint to the rest of the snake
     snakeController.UpdateWayPoints(nextGridPoint);
 }