using System;
using UnityEngine;
namespace Framework.Input.States {
/// Gives an input action a default key binding
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)]
public class DefaultKeyAttribute : Attribute {
/// Initializes a new default key provider
/// Key that will be bound to the action by default
public DefaultKeyAttribute(KeyCode defaultKey) {
this.positiveDefaultKey = defaultKey;
}
/// Initializes a new default key provider
/// Key that will be bound to the action by default
/// Whether to bind the key to the negative action
public DefaultKeyAttribute(KeyCode defaultKey, bool negative) {
if(negative) {
this.negativeDefaultKey = defaultKey;
} else {
this.positiveDefaultKey = defaultKey;
}
}
/// Initializes a new default key provider
///
/// Key that will be bound to the negative side of the action by default
///
///
/// Key that will be bound to the positive side of the action by default
///
public DefaultKeyAttribute(KeyCode negativeDefaultKey, KeyCode positiveDefaultKey) {
this.negativeDefaultKey = negativeDefaultKey;
this.positiveDefaultKey = positiveDefaultKey;
}
/// Default key that will be bound to the negative side of the axis
public KeyCode NegativeDefaultKey {
get { return this.negativeDefaultKey; }
}
/// Default key that will be bound to the positive side of the axis
public KeyCode PositiveDefaultKey {
get { return this.positiveDefaultKey; }
}
/// Default key that will be bound to the negative side of the axis
private KeyCode negativeDefaultKey;
/// Default key that will be bound to the positive side of the axis
private KeyCode positiveDefaultKey;
}
} // namespace Framework.Input.States