Hi all !
After playing KSP for a while and using a couple of mods, i decided to try and create my own. I would like to create a Stuka-like-siren part, which make an increasingly higher sound depending of the speed, when activated. I don't want the sound to be played when my custom part is not attached to the vessel, and i don't want all parts to play the sound. I have a basic undersanding in object oriented programming, and i'm fairly new to c#.
My problem is, i didn't find the way to get the vessel info "srfSpeed" (see: http://wiki.kerbalspaceprogram.com/wiki/API:Vessel#Fields).
public class ModuleStukaSiren : PartModule
{
double vspeed = vessel.srfspeed;
}
I get this error : A field initializer cannot reference the nonstatic field, method, or property...
As far as i know/understood, i can't set that class as static, and at this point i don't even know if i can access the class "vessel" through PartModule (whereas Documentation for the KSP API let me think i should), or even if the class "vessel" needs to be used. I spent the afternoon on c#, KSP API, KSP plugins related forums, without conclusive result.
So, is it possible to access the vessel info through a plugin for a module i will attach on a specific part, and how ? Does someone have in mind some simple tutorial or mod source which can help or inspire me ?
My apologies if that question is dumb and only c# related, and sorry for my bad english.
Thanks
Roiarg