/// <summary> /// Constructor which initializes the KeyboardConfiguration Array. Currently, fixed sized of 10 players. /// </summary> public Configuration() { keyConfigurations = new KeyboardConfiguration[10]; for (int i = 0; i < keyConfigurations.Length; i++) { keyConfigurations[i] = new KeyboardConfiguration(); } }
/// <summary> /// Sets the KeyboardConfiguration for the specified player. /// </summary> /// <param name="playerID">The ID which specifies the player.</param> /// <param name="keyConfiguration">The KeyboardConfiguration of the specified player.</param> public void SetKeyboardConfiguration(int playerID, KeyboardConfiguration keyConfiguration) { if (playerID < 1 || playerID > keyConfigurations.Length) { return; } this.keyConfigurations[playerID] = keyConfiguration; }
/// <summary> /// Checks if the assigned KeyboardConfiguration object is /// equal to this one. /// Objects are defined equal if all the respective keyboard shortcuts match with each other. /// </summary> /// <param name="secKeyConf">The KeyboardConfiguration which needs to be checked for equality.</param> /// <returns>true if all respective keyboard shortcuts are equal. false otherwise.</returns> public bool Equals(KeyboardConfiguration secKeyConf) { if (secKeyConf == null) return false; if (this.backward != secKeyConf.backward || this.fire != secKeyConf.fire || this.forward != secKeyConf.forward || this.left != secKeyConf.left || this.nextWeapon != secKeyConf.nextWeapon || this.prevWeapon != secKeyConf.prevWeapon || this.right != secKeyConf.right) return false; return true; }