// Private Constructor private SceneManager() : base() { this.activeScene = null; this.totalNumberOfPlayers = NumberOfPlayers.One; this.colliderToggleKey = Azul.AZUL_KEYS.KEY_D; this.internalClock = 0.0f; this.globalHighScore = 0; this.cachedPlayerOneScore = 0; this.cachedPlayerTwoScore = 0; }
/// <summary> /// Indexer for getting an InputKey given an AZUL_KEY in constant time /// </summary> /// <param name="keyName"></param> /// <returns></returns> public InputKey this[Azul.AZUL_KEYS keyName] { get { int index = (int)keyName; InputKey key = this.hashBucket[index]; string assetMessage = ""; if (key == null) { assetMessage = "The key \"" + keyName.ToString() + "\" is not supported. Please add it to InputKeyMap.CreateAllInputKeys()"; } Debug.Assert(key != null, assetMessage); return(key); } }
/////////////////////////////////////////////////////// // // Other Public Methods // /////////////////////////////////////////////////////// /// <summary> /// Set the key that should toggle the render of collision boxes. /// You must go to InputKeyMap.CreateAllInputKeys() for supported Keys! /// </summary> /// <param name="newKey"></param> public void SetColliderToggleKey(Azul.AZUL_KEYS newKey) { this.colliderToggleKey = newKey; }
public InputKey(Azul.AZUL_KEYS keyName) { this.name = keyName; this.previousState = false; this.currentState = false; }
/// <summary> /// Create a new entry in the hashtable given the Azul Key /// </summary> /// <param name="?"></param> private void NewEntry(Azul.AZUL_KEYS newKeyName) { int index = (int)newKeyName; this.hashBucket[index] = new InputKey(newKeyName); }
/// <summary> /// Returns true if the key is currently pressed down /// </summary> /// <param name="key"></param> /// <returns></returns> public static bool GetKey(Azul.AZUL_KEYS key) { return(InputKeyController.GetKey(key)); }
/// <summary> /// Returns true the moment the key is released /// (should only return true once per key press) /// </summary> /// <param name="key"></param> /// <returns></returns> public static bool GetKeyUp(Azul.AZUL_KEYS key) { return(InputKeyController.keyMap[key].GetKeyUp()); }