本文整理汇总了C#中InputHandler类的典型用法代码示例。如果您正苦于以下问题:C# InputHandler类的具体用法?C# InputHandler怎么用?C# InputHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InputHandler类属于命名空间,在下文中一共展示了InputHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Awake
void Awake()
{
if (this.inputHandler == null) {
this.inputHandler = this.transform.parent.GetComponent<InputHandler>();
}
this.rigidBody = this.GetComponent<Rigidbody2D>();
}
示例2: UpdateState
public override void UpdateState(GameTime time, InputHandler input)
{
if (KeyIsPushed(Keys.Escape))
{
this.EndState();
}
if (KeyIsPushed(Keys.Enter))
{
//activate selected ability
examinedItem.Abilities[abilityNames[selectedIndex]].ItemAction(player);
this.EndState();
}
if (KeyIsPushed(KeyBindings.UP))
{
selectedIndex = (selectedIndex > 0 ? selectedIndex - 1 : abilityNames.Count - 1);
}
if (KeyIsPushed(KeyBindings.DOWN))
{
if (selectedIndex + 1 < abilityNames.Count)
{
selectedIndex++;
}
else
{
selectedIndex = 0;
}
}
}
示例3: Awake
void Awake ()
{
if (Instance){
Destroy(gameObject);
} else {
DontDestroyOnLoad(gameObject);
Instance = this;
}
//Check PlayerPrefs to see if the three main things are saved. If not, set them to default levels.
if(PlayerPrefs.HasKey("Score")){
score = PlayerPrefs.GetFloat("Score");
} else{
score = 0;
}
if(PlayerPrefs.HasKey("CurrentUnlockedLevel")){
currentUnlockedLevel = PlayerPrefs.GetInt("CurrentUnlockedLevel");
} else{
currentUnlockedLevel = 10;
}
if(PlayerPrefs.HasKey("CurrentLevel")){
currentLevel = PlayerPrefs.GetInt("CurrentLevel");
} else {
currentLevel = 0;
}
if(PlayerPrefs.HasKey("Vibrations")){
vibrations = PlayerPrefs.GetInt("Vibrations");
} else {
vibrations = 1;
}
ih = (InputHandler)gameObject.GetComponent(typeof(InputHandler));
}
示例4: Start
// Use this for initialization
void Start()
{
stats = player.GetComponent<PlayerStats> ();
lastPos = GetComponent<Transform>().position;
playerInputManager = GameObject.FindGameObjectWithTag("Player").GetComponent<InputHandler>();
}
示例5: GetTopInteracting
public override DragDropElement GetTopInteracting(InputHandler handler)
{
if (varLink != null)
return varLink.GetElement();
return this;
//throw new NotImplementedException();
}
示例6: GetInteracting
public override DragDropElement GetInteracting(InputHandler handler)
{
if (varLink != null)
return varLink.GetElement().GetInteracting(handler);
else
return this;
}
示例7: GetInnerMostDragDrop
public DragDropElement GetInnerMostDragDrop(InputHandler handler)
{
if (varLink != null && varLink.GetElement().GetTopInteracting(handler) is DragDropVariablePlaceholder)
return ((DragDropVariablePlaceholder)varLink.GetElement().GetTopInteracting(handler)).GetInnerMostDragDrop(handler);
else
return this;
}
示例8: RemoteClass
private int sameButtonPushedCount = 0; // tracks the number of times the same button was pushed in a row
#endregion Fields
#region Methods
/// <summary>
/// Starts this instance.
/// </summary>
void IPlugin.Start()
{
//File.AppendAllText(@"c:\AverRmHv.txt", "Start Llamado\n\r");
try
{
rc = new RemoteClass();
rc.Initialize();
rc.OnRemoteData += RecibeDatos;
//string mediaportalpath = AppDomain.CurrentDomain.ApplicationIdentity.FullName;
string mediaportalpath = System.Reflection.Assembly.GetEntryAssembly().FullName;
rc.SwitchBeginAP(mediaportalpath);
Log.Info("AverRMHV Plugin: Started by " + mediaportalpath);
//File.AppendAllText(@"c:\AverRmHv.txt", "Inicialización Correcta. Path = " + mediaportalpath);
}
catch (Exception e)
{
//File.AppendAllText(@"c:\AverRmHv.txt", "Error en Start\n\r");
Log.Error("AverRMHV Plugin: AverRemote.exe not responding");
Log.Error("AverRMHV Plugin: Exception: "+e);
}
inputhandler = new InputHandler(mappingfile);
if (inputhandler == null || !inputhandler.IsLoaded)
{
//File.AppendAllText(@"c:\AverRmHv.txt", "AverRMHV Plugin: File " + mappingfile + " not loaded.\n\r");
Log.Error("AverRMHV Plugin: File " + mappingfile + " not loaded.");
}
lastTimeActionPerformed = DateTime.Now;
lastTimeButtonPushed = DateTime.Now;
Log.Info("AverRMHV Plugin: Started.");
}
示例9: BackupManager
public BackupManager(MultiBoard multiBoard, InputHandler input, HaCreatorStateManager hcsm, HaCreator.ThirdParty.TabPages.PageCollection tabs)
{
this.input = input;
this.multiBoard = multiBoard;
this.hcsm = hcsm;
this.tabs = tabs;
}
示例10: Awake
private void Awake()
{
m_collider2D = GetComponent<Collider2D>();
// E-man - Begin
motherShipExplosion = GameObject.Find("MotherShipExplosion");
if (motherShipExplosion)
{
motherShipExplosion.SetActive(false);
}
else
{
Debug.Log("DopHatch::Awake(), Hey buddy! Can't find your explosion guy!");
}
// E-man - End
m_objectState = GetComponent<ObjectState>();
Handler = GameObject.Find("Input Handler");
Ihandler = Handler.GetComponent<InputHandler>();
GameObject go = GameObject.Find("Pod");
m_podRigidbody = go.GetComponent<Rigidbody2D>();
// E-man
as_explosion = GetComponent<AudioSource>();
if(!fire)
{
Debug.Log("DopHatch::Awake(), Hey buddy! Can't seem to find your fire fwiend!");
}
}
示例11: Game1
public Game1()
{
graphics = new GraphicsDeviceManager(this);
graphics.PreferredBackBufferWidth = 1366;
graphics.PreferredBackBufferHeight = 768;
Content.RootDirectory = "Content";
sb = new SpriteBatch(GraphicsDevice);
input = new InputHandler(this);
this.Components.Add(input);
celAnimationManager = new CelAnimationManager(this);
this.Components.Add(celAnimationManager);
GameManager = new GameStateManager(this);
PlayingState = new PlayingState(this);
PausedState = new PausedState(this);
TitleState = new TitleIntroState(this);
StartMenuState = new StartMenuState(this);
EndState = new EndState(this);
GameManager.ChangeState(TitleState.Value);
//GameManager.ChangeState(PlayingState.Value);
}
示例12: StandardMelee
public StandardMelee(InputHandler handler)
{
_mousePosition = new Vector2f(500, 500);
CurrentStatus = StatusState.WaitingForPlayers;
uiState = UIStateTypes.Normal;
currentHotkey = null;
currentHotkeySheet = null;
standardHotkeys = Settings.GetSheet("standard_game_mode_controls");
InputHandler = handler;
myId = 0;
map = new TileMap();
allowMinimapCameraMove = true;
selectedUnits = null;
controlGroups = new Dictionary<Keyboard.Key, List<EntityBase>>();
for (int i = 27; i <= 35; i++)
{
controlGroups.Add((Keyboard.Key) i, new List<EntityBase>());
}
controlBoxP1 = new Vector2f(0, 0);
controlBoxP2 = new Vector2f(0, 0);
selectedAttackMove = false;
releaseSelect = false;
CameraPosition = new Vector2f(0, 0);
miniMap = new MiniMap(map, Fog, entities);
//Load Sprites
bottomHUDGUI = new Sprite(ExternalResources.GTexture("Resources/Sprites/HUD/BottomGUI.png"));
alertHUDAlert = new Sprite(ExternalResources.GTexture("Resources/Sprites/HUD/Alert_Alert.png"));
alertHUDUnitCreated = new Sprite(ExternalResources.GTexture("Resources/Sprites/HUD/Alert_UnitCreated.png"));
alertHUDBuildingCreated =
new Sprite(ExternalResources.GTexture("Resources/Sprites/HUD/Alert_BuildingFinished.png"));
avatarWorker = new Sprite(ExternalResources.GTexture("Resources/Sprites/HUD/HUD_AVATAR_WORKER.png"));
hudBoxUnit = new Sprite(ExternalResources.GTexture("Resources/Sprites/HUD/HUD_BOX_Unit.png"));
hudBoxBuilding = new Sprite(ExternalResources.GTexture("Resources/Sprites/HUD/HUD_BOX_Building.png"));
hudControlBox = new Sprite(ExternalResources.GTexture("Resources/Sprites/HUD/ControlGroupBox.png"));
hudControlBox.Origin = new Vector2f(hudControlBox.TextureRect.Width/2, 0);
viewBounds = new Sprite(ExternalResources.GTexture("Resources/Sprites/Hud/ViewBounds.png"));
//Load Sounds
moveSound = new Sound(ExternalResources.GSoundBuffer("Resources/Audio/MoveCommand/0.wav"));
attackMoveSound = new Sound(ExternalResources.GSoundBuffer("Resources/Audio/AttackCommand/0.wav"));
backgroundMusic = new Music("Resources/Audio/Music/In Game/mario.wav");
backgroundMusic.Loop = true;
backgroundMusic.Volume = Settings.MUSICVOLUME;
backgroundMusic.Play();
}
示例13: Start
// Up, Down, Left, Right = 0, 1, 2, 3
public virtual void Start ()
{
rb = this.gameObject.GetComponent<Rigidbody> ();
// TileMoving objects should never have physics push them in the y direction, nor should it rotate them.
rb.constraints = RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezeRotation;
GameObject gc = GameObject.FindGameObjectWithTag ("GameController");
ih = (InputHandler)gc.GetComponent(typeof(InputHandler));
}
示例14: Update
public void Update(InputHandler handler)
{
foreach(LevelObject obj in objects)
{
obj.SetEditing(false);
obj.Update(handler);
}
}
示例15: GetInteracting
public override DragDropElement GetInteracting(InputHandler handler)
{
if(handler.CheckMouseIn(holder))
{
return holder.GetInteracting(handler);
}
return this;
}