void Start() { snakeHead = GameObject.FindGameObjectWithTag("snakeHead").GetComponent <snakeMovement>(); speed = snakeHead.speed * 4f * Time.deltaTime * 80; tailTargetObj = snakeHead.snakeBody[snakeHead.snakeBody.Count - 2]; index = snakeHead.snakeBody.IndexOf(gameObject); }
public static void OnGameOver(snakeMovement snake) { hs = PlayerPrefs.GetFloat("HighScore", 0); if (hs < snake.score) { PlayerPrefs.SetFloat("HighScore", snake.score); } PlayerPrefs.SetFloat("score", snake.score); snake.score = 0; SceneManager.LoadScene("gameOver"); }