void Awake() { UIMainScript mainUIScript = (UIMainScript)FindObjectOfType(typeof(UIMainScript)); if (mainUIScript != null) { GetComponent <UIPanel>().enabled = false; } }
public void loadLevel(string levelName) { Destroy(this.gameObject); UIMainScript main = (UIMainScript)FindObjectOfType(typeof(UIMainScript)); if (main != null) { Destroy(main.gameObject); } Application.LoadLevel(levelName); }
/****************************************************** * MonoBehaviour methods, Awake ******************************************************/ void Awake() { if (players == null) { players = new PlayerScript[8]; } players[playerId] = this; this.myTransform = transform; this.myRigidbody = rigidbody; playerPosition = GetComponent <PlayerPositionScript>(); controls = GetComponent <PlayerControls>(); follower = GetComponent <PathFollowScript>(); UIMainScript mainUIScript = (UIMainScript)FindObjectOfType(typeof(UIMainScript)); if (mainUIScript != null) { follower.isMoving = true; IsHuman = false; } // register all the multiplier components within this gameobject Component[] multiplierComponents = GetComponentsInChildren(typeof(IAccelMultiplier)); accelMultipliers = new IAccelMultiplier[multiplierComponents.Length]; for (int i = 0; i < multiplierComponents.Length; i++) { accelMultipliers[i] = (IAccelMultiplier)multiplierComponents[i]; } motionListeners = new List <IPlayerMotionListener>(); statListeners = new List <IStatListener>(); IsHuman = isHuman; }