public void HeadReachedNextLoc() { movementDirection = nextDirection; head.ChangeDirection(movementDirection); ClientChangeHeadDirection(movementDirection); if (pendingTailCount > 0) { SpawnTail(pendingTailCount, false); } }
public void ChangeDirection(DirectionHelper.Directions direction) { if (!isServer) { HandleFiller(direction); } if (!isMoving) { InitMovement(direction); StartMoving(); return; } //If the tail is newly created then start moving transform.position = new Vector3(nextLoc.x, transform.position.y, nextLoc.y); if (nextTail != null) { nextTail.ChangeDirection(movementDirection); } movementDirection = direction; SetNewNextLoc(); }