Author Topic: SGSK - Missile question  (Read 2774 times)

emachala

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
SGSK - Missile question
« on: October 02, 2014, 10:29:57 AM »
Looking for best place to limit Missile launch, Im going to pass a bool from another script. To allow me to wait for missile bay doors to open before firing. In fact i plan to have all secondary attacks/abilities be checked against a var.

That being said would this be the best place to check if my bay doors are open(set to true or false)?

was testing earlier with missile.cs script but now i think this is a better place to check bool.

  1.                                         // Fire the secondary weapon and check for secondary bay is open
  2.                                         if (mSecondary.Count > 0 && (Input.GetMouseButton(1) || Input.GetKey(KeyCode.JoystickButton5)))
  3.                                         {
  4.                                                 if (mNextSecondary < Time.time)
  5.                                                 {
  6.                                                         mNextSecondary = Fire(mSecondary);
  7.                                                 }
  8.                                         }

Side note haven't torn thru missiles yet, i know there is a energy depletion on fire? is there a missile count variable in place already? I could re-task from unlimited or must i add one?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: SGSK - Missile question
« Reply #1 on: October 02, 2014, 11:33:05 PM »
There is no missile counter. If you want to add a condition for firing eligibility, it's best to do so right before the actual input checks. If the criteria is not met, exit early.