News: Enjoy our Christmas offer 30% off on our latest package Tower Defense Level Kit http://u3d.as/m7h

  • July 23, 2018, 07:14:35 PM

Login with username, password and session length

Author Topic: Integrating into existing control system  (Read 757 times)

Offline jmschrack

  • Newbie
  • *
  • Posts: 1
Integrating into existing control system
« on: July 25, 2016, 05:57:25 PM »
Hello!
I'm looking to integrate the Weapon system into our existing user input and control system.  I've been going over the source code, and it looks like I can just call "Shoot()" and "StopShoot()" and use a boolean to avoid spamming the Shoot() method.

For example
Code: [Select]
Weapon w;

...
       if(trigger>=triggerThreshold&&!shooting){
shooting=true;
w.Shoot();
}else if(trigger<triggerThreshold){
w.StopShoot();
shooting=false;
}
}

Is this the way it should be done or is there a better/ more preferred way to accomplish this?

Offline Nicolas

  • Administrator
  • Hero Member
  • *****
  • Posts: 792
Re: Integrating into existing control system
« Reply #1 on: July 25, 2016, 10:53:29 PM »
Hi,

That's exactly right, you just have to call Shoot & StopShoot. (The API documentation is expected to arrive with the Beta 2 late August )

If you want to make one shoot, instead of putting a boolean, simply activate the one shot mode on the weapon