public void Restart() { GenerateWalls(); Snakes.Clear(); AddAISnake(); if (hasPlayer == true) { AddPlayerSnake(); } GenerateFoodPiece(); AssembleMap(); Running = true; Score = 0; }
void Start() { //Save Time timeLastStep = PhotonNetwork.Time; //Apply game speed byte gameSpeed = (byte)PhotonNetwork.CurrentRoom.CustomProperties[RoomOptionKeys.GameSpeed]; timeBetweenStep = 0.9d - gameSpeed / 10d; //0.9d just magic number (works normal for ping 100ms and less in max speed) //Clear data from old game Snakes?.Clear(); Fruit = null; //Set TimeLeft to start value timeLeft = (byte)PhotonNetwork.CurrentRoom.CustomProperties[RoomOptionKeys.GameTimeInSeconds]; timeLeftText.text = TimePrefix + math.round(timeLeft); }