Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class characterSelection : MonoBehaviour {
- public bool firstIsEnabled = true;
- public bool secondIsEnabled = false;
- public bool thirdIsEnabled = false;
- public Transform firstCharacter;
- public Transform secondCharacter;
- public Transform thirdCharacter;
- void Update () {
- if (Input.GetKeyDown(KeyCode.F1) && firstIsEnabled == true) {
- GetComponent<characterController>().enabled = false;
- secondCharacter.GetComponent<characterController>().enabled = false;
- thirdCharacter.GetComponent<characterController>().enabled = false;
- }
- if (Input.GetKeyDown(KeyCode.F1) && firstIsEnabled == false) {
- GetComponent<characterController>().enabled = true;
- secondCharacter.GetComponent<characterController>().enabled = false;
- thirdCharacter.GetComponent<characterController>().enabled = false;
- }
- if (Input.GetKeyDown(KeyCode.F2) && secondIsEnabled == true) {
- GetComponent<characterController>().enabled = false;
- secondCharacter.GetComponent<characterController>().enabled = false;
- thirdCharacter.GetComponent<characterController>().enabled = false;
- }
- if (Input.GetKeyDown(KeyCode.F2) && secondIsEnabled == false) {
- GetComponent<characterController>().enabled = false;
- secondCharacter.GetComponent<characterController>().enabled = true;
- thirdCharacter.GetComponent<characterController>().enabled = false;
- }
- if (Input.GetKeyDown(KeyCode.F3) && thirdIsEnabled == true) {
- GetComponent<characterController>().enabled = false;
- secondCharacter.GetComponent<characterController>().enabled = false;
- thirdCharacter.GetComponent<characterController>().enabled = false;
- }
- if (Input.GetKeyDown(KeyCode.F3) && thirdIsEnabled == false) {
- GetComponent<characterController>().enabled = false;
- secondCharacter.GetComponent<characterController>().enabled = false;
- thirdCharacter.GetComponent<characterController>().enabled = true;
- }
- if (GetComponent<characterController>().enabled == true){
- firstIsEnabled = true;
- }
- if (GetComponent<characterController>().enabled == false){
- firstIsEnabled = false;
- }
- if (secondCharacter.GetComponent<characterController>().enabled == true){
- secondIsEnabled = true;
- }
- if (secondCharacter.GetComponent<characterController>().enabled == false){
- secondIsEnabled = false;
- }
- if (thirdCharacter.GetComponent<characterController>().enabled == true){
- thirdIsEnabled = true;
- }
- if (thirdCharacter.GetComponent<characterController>().enabled == false){
- thirdIsEnabled = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement