BrettM
5/21/2019 - 1:43 AM

[Beginner] Level Selector

public int currentDifficulty;
public int easy = 1, normal = 2, hard = 3;

void Start()
{
  // WAY #1 with if statements
  if (currentDifficulty == easy)
  {
    Debug.Log("You selected easy!");
  }
  else if (currentDifficulty == normal)
  {
    Debug.Log("You selected normal!");
  }
  else 
  {
    Debug.Log("You selected hard!");
  }
  
    // WAY #2 with switch statements
  switch (currentDifficulty)
  {
  case 1:
    Debug.Log("You selected easy!");
    break;
  case 2:
    Debug.Log("You selected normal!");
    break;
  case 3:
    Debug.Log("You selected hard!");
    break;
  default:
    Debug.Log("Invalid!");
    break;
}

void Update()
{
  
}