public static FighterState getFighter(int index) { if (P1 == null) { P1 = new FighterState(0); } if (P2 == null) { P2 = new FighterState(1); } return(index == 0 ? P1 : P2); }
public void pressButton(FighterState.Input key, KeyMode mode) { if (mode == KeyMode.RELEASE) { if (held.Contains(key)) held.Remove(key); if (pressed.Contains(key)) pressed.Remove(key); } else if (mode == KeyMode.HOLD) { if (!held.Contains(key)) held.Add(key); if (!pressed.Contains(key)) pressed.Add(key); } else { if (!pressed.Contains(key)) pressed.Add(key); } }
public static FighterState getFighter(int index) { if (P1 == null) P1 = new FighterState(0); if (P2 == null) P2 = new FighterState(1); return index == 0 ? P1 : P2; }
private static void UpdateOverlay(TextLabel label, FighterState f) { f.UpdatePlayerState(); label.Text = String.Format("X={0,-7} Y={1,-7} XVel={12,-7} YVel={13,-7}\n{2,-15} F:{3,-3}\nACT:{4,-3} ENDACT:{5,-3} IASA:{6,-3} TOT:{7,-3}\n{8,-10} {9,-10} {10,-10} {11:X}\n{14}", f.X, f.Y, f.ScriptName, f.ScriptFrame, f.ScriptFrameHitboxStart, f.ScriptFrameHitboxEnd, f.ScriptFrameIASA, f.ScriptFrameTotal, f.State, f.AState, f.StateTimer, f.RawState, f.XVelocity, f.YVelocity, String.Join(", ", f.ActiveCancelLists)); }
/// <summary> /// This sets up the bot to know which side it is playing on. /// </summary> public void Init(int index) { myState = FighterState.getFighter(index); enemyState = FighterState.getFighter(index == 0 ? 1 : 0); inputAdapter = new MemoryInputAdapter(index); }
/// <summary> /// These keycodes exist so that we can map them to keyboard or vJoy or whatever. /// </summary> /// <summary> /// TODO: Load this mapping from an XML file, change this function to a dictionary. Support P2 mapping. /// </summary> private static WindowsInput.VirtualKeyCode map(FighterState.Input key) { WindowsInput.VirtualKeyCode rawKey; switch (key) { case FighterState.Input.DOWN: default: rawKey = WindowsInput.VirtualKeyCode.DOWN; break; case FighterState.Input.LEFT: rawKey = WindowsInput.VirtualKeyCode.LEFT; break; case FighterState.Input.RIGHT: rawKey = WindowsInput.VirtualKeyCode.RIGHT; break; case FighterState.Input.UP: rawKey = WindowsInput.VirtualKeyCode.UP; break; case FighterState.Input.LP: rawKey = WindowsInput.VirtualKeyCode.VK_9; break; case FighterState.Input.MP: rawKey = WindowsInput.VirtualKeyCode.VK_0; break; case FighterState.Input.HP: rawKey = WindowsInput.VirtualKeyCode.OEM_MINUS; break; case FighterState.Input.LK: rawKey = WindowsInput.VirtualKeyCode.VK_O; break; case FighterState.Input.MK: rawKey = WindowsInput.VirtualKeyCode.VK_P; break; case FighterState.Input.HK: rawKey = WindowsInput.VirtualKeyCode.OEM_4; break; } return rawKey; }