public void handleInputs(float percentSecond) { List <String> temp = new List <String>(); if (GamePad.GetState(m_index).ThumbSticks.Left.X >= 0.2) { temp.Add("UNIT-TURN-LEFT"); } if (GamePad.GetState(m_index).ThumbSticks.Left.X <= -0.2) { temp.Add("UNIT-TURN-RIGHT"); } if (GamePad.GetState(m_index).ThumbSticks.Left.Y >= 0.2) { temp.Add("UNIT-MOVE-FORWARD"); } if (GamePad.GetState(m_index).ThumbSticks.Left.Y <= -0.2) { temp.Add("UNIT-MOVE-BACKWARD"); } // Focus Moves if (GamePad.GetState(m_index).Triggers.Right >= 0.5) { if (GamePad.GetState(m_index).IsButtonDown(Buttons.B) && !m_heldButtons.Contains(Buttons.B)) { temp.Add("UNIT-COMMAND-START-DODGE-FOCUS"); } } // Non Focus Equivilants else { if (GamePad.GetState(m_index).IsButtonDown(Buttons.B) && !m_heldButtons.Contains(Buttons.B)) { temp.Add("UNIT-COMMAND-START-DODGE"); } if (GamePad.GetState(m_index).IsButtonDown(Buttons.X) && !m_heldButtons.Contains(Buttons.X)) { temp.Add("UNIT-COMMAND-START-ATTACK"); } } m_heldButtons.Clear(); checkHeldButtons(Buttons.A); checkHeldButtons(Buttons.B); checkHeldButtons(Buttons.X); checkHeldButtons(Buttons.Y); m_controller.handleCommand(temp, percentSecond); }
public bool TESTFAKEAI(UnitController uc, float percentSecond, Random ran) { List <String> blank = new List <string>(); List <String> attack = new List <string>(); attack.Add("UNIT-COMMAND-START-ATTACK"); List <String> forward = new List <String>(); forward.Add("UNIT-MOVE-FORWARD"); if (uc.m_unit.m_important != true) { int x = ran.Next(300); if (x == 1) { uc.handleCommand(attack, percentSecond); return(true); } else if (x % 2 == 0) { if (x % 4 == 0) { forward.Add("UNIT-TURN-RIGHT"); } else if (x % 4 == 2) { forward.Add("UNIT-TURN-LEFT"); } uc.handleCommand(forward, percentSecond); } else { uc.handleCommand(blank, percentSecond); } } return(false); }
public bool TESTFAKEAI(UnitController uc, float percentSecond, Random ran) { List<String> blank = new List<string>(); List<String> attack = new List<string>(); attack.Add("UNIT-COMMAND-START-ATTACK"); List<String> forward = new List<String>(); forward.Add("UNIT-MOVE-FORWARD"); if (uc.m_unit.m_important != true) { int x = ran.Next(300); if (x == 1) { uc.handleCommand(attack, percentSecond); return true; } else if (x % 2 == 0) { if (x % 4 == 0) forward.Add("UNIT-TURN-RIGHT"); else if (x % 4 == 2) forward.Add("UNIT-TURN-LEFT"); uc.handleCommand(forward, percentSecond); } else { uc.handleCommand(blank, percentSecond); } } return false; }