internal KeyHistory GetKeyHistory(KeyHistoryId keyHistoryId) { int id = keyHistoryId.GetId(); if (id < keyHistories.Count) { return(keyHistories[id]); } else { return(null); } }
protected override KappaBuilder AddMoves(KeyManager manager) { Kappa kappa = GetObj().GetComponent <Kappa>(); Movement <KappaAction, Kappa> movement = new Movement <KappaAction, Kappa>(); kappa.InitMoves(movement); KeyHistoryId moveLeft = manager.AddKeyHistory(new AxisHistory(new KeyStroke(KeyType.LeftJoyX), 0f, -1f, -AXIS_X_DEADZONE)); KeyHistoryId moveRight = manager.AddKeyHistory(new AxisHistory(new KeyStroke(KeyType.LeftJoyX), 0f, AXIS_X_DEADZONE, 1f)); KeyHistoryId standStill = manager.AddKeyHistory(new AxisHistory(new KeyStroke(KeyType.LeftJoyX), 0f, -AXIS_X_DEADZONE, AXIS_X_DEADZONE)); { KeyCombo combo = new KeyCombo(manager); combo.RegisterKeyHistory(moveLeft); kappa.AddMove(new Move <KappaAction>(combo, KappaAction.Left, PriorityConstants.PRIORITY_MOVE_LEFT)); } { KeyCombo combo = new KeyCombo(manager); combo.RegisterKeyHistory(moveRight); kappa.AddMove(new Move <KappaAction>(combo, KappaAction.Right, PriorityConstants.PRIORITY_MOVE_RIGHT)); } { KeyCombo combo = new KeyCombo(manager); combo.RegisterKeyHistory(standStill); kappa.AddMove(new Move <KappaAction>(combo, KappaAction.Stand, PriorityConstants.PRIORITY_STAND_STILL)); } return(this); }
private void AddMovesGPDXD(KeyManager manager) { Player player = GetObj().GetComponent <Player>(); KeyHistoryId leftX = manager.AddKeyHistory(new AxisHistory(new KeyStroke(new GPDXDKeyHandler(GPDXDKeyType.LeftJoyX)), 0f, -1f, 1f)); KeyHistoryId leftY = manager.AddKeyHistory(new AxisHistory(new KeyStroke(new GPDXDKeyHandler(GPDXDKeyType.LeftJoyY)), 0f, -1f, 1f)); { KeyCombo combo = new KeyCombo(manager); PlayerAction action = PlayerAction.MakePlayerWalkAction(1f, 1f); combo.RegisterKeyHistory(leftX); combo.RegisterKeyHistory(leftY); Move <PlayerAction> move = new Move <PlayerAction>(combo, action, PriorityConstants.PRIORITY_WALK); player.AddMove(move); } //KeyHistoryId leftLeft = manager.AddKeyHistory(new AxisHistory(new KeyStroke(new GPDXDKeyHandler(GPDXDKeyType.LeftJoyX)), 0f, -1f, -0.1f)); //KeyHistoryId leftRight = manager.AddKeyHistory(new AxisHistory(new KeyStroke(new GPDXDKeyHandler(GPDXDKeyType.LeftJoyX)), 0f, 0.1f, 1f)); //KeyHistoryId leftUp = manager.AddKeyHistory(new AxisHistory(new KeyStroke(new GPDXDKeyHandler(GPDXDKeyType.LeftJoyY)), 0f, 0.1f, 1f)); //KeyHistoryId leftDown = manager.AddKeyHistory(new AxisHistory(new KeyStroke(new GPDXDKeyHandler(GPDXDKeyType.LeftJoyY)), 0f, -1f, -0.1f)); //{ // KeyCombo combo = new KeyCombo(manager); // PlayerAction action = PlayerAction.MakePlayerWalkAction(1f, 1f); // combo.RegisterKeyHistory(leftLeft); // Move<PlayerAction> move = new Move<PlayerAction>(combo, action, PriorityConstants.PRIORITY_WALK_LEFT); // player.AddMove(move); //} //{ // KeyCombo combo = new KeyCombo(manager); // PlayerAction action = PlayerAction.MakePlayerWalkAction(1f, 1f); // combo.RegisterKeyHistory(leftRight); // Move<PlayerAction> move = new Move<PlayerAction>(combo, action, PriorityConstants.PRIORITY_WALK_RIGHT); // player.AddMove(move); //} //{ // KeyCombo combo = new KeyCombo(manager); // PlayerAction action = PlayerAction.MakePlayerWalkAction(1f, 1f); // combo.RegisterKeyHistory(leftUp); // Move<PlayerAction> move = new Move<PlayerAction>(combo, action, PriorityConstants.PRIORITY_WALK_UP); // player.AddMove(move); //} //{ // KeyCombo combo = new KeyCombo(manager); // PlayerAction action = PlayerAction.MakePlayerWalkAction(1f, 1f); // combo.RegisterKeyHistory(leftDown); // Move<PlayerAction> move = new Move<PlayerAction>(combo, action, PriorityConstants.PRIORITY_WALK_DOWN); // player.AddMove(move); //} }
public void RegisterKeyHistory(KeyHistoryId keyHistoryId) { keyHistories.Add(keyManager.GetKeyHistory(keyHistoryId)); }