public void RpcDeactivateObstacle(int obstacleIndex) { ObstacleNetworking obstacle = obstacles[obstacleIndex]; if (obstacle != null) { obstacle.DeactivateFromServer(); } }
public void RpcResetObstacle(int obstacleIndex) { ObstacleNetworking obstacle = obstacles[obstacleIndex]; if (obstacle != null) { obstacle.ResetFromServer(); } }
// Find the index of the obstacle public int GetObstacleIndex(ObstacleNetworking obstacle) { int obstacleIndex = 0; foreach (ObstacleNetworking o in obstacles) { if (obstacle.gameObject == o.gameObject) { return(obstacleIndex); } obstacleIndex++; } return(-1); }
// Deactivate the obstacle on the server public void DeactivateObstacle(ObstacleNetworking obstacle) { IntegerMessage msg = new IntegerMessage(GetObstacleIndex(obstacle)); NetworkManager.singleton.client.connection.Send(DEACTIVATE_MESSAGE, msg); }
public void ResetObstacle(ObstacleNetworking obstacle) { IntegerMessage msg = new IntegerMessage(GetObstacleIndex(obstacle)); NetworkManager.singleton.client.connection.Send(RESET_MESSAGE, msg); }