Advertisement
Guest User

CharacterSelection1

a guest
Feb 5th, 2015
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.58 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class characterSelection : MonoBehaviour {
  5.  
  6.     public bool isEnabled = false;
  7.  
  8.     void Update () {
  9.         if (Input.GetKeyDown(KeyCode.F1) && isEnabled == true) {
  10.             GetComponent<characterController>().enabled = false;
  11.         }
  12.  
  13.         if (Input.GetKeyDown(KeyCode.F1) && isEnabled == false) {
  14.             GetComponent<characterController>().enabled = true;
  15.         }
  16.  
  17.         if (GetComponent<characterController>().enabled == true){
  18.             isEnabled = true;
  19.         }
  20.  
  21.         if (GetComponent<characterController>().enabled == false){
  22.             isEnabled = false;
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement