public AudioClip gunclock, pistolsfx, shotgunsfx, riflesfx; // sound effects // Use this for initialization void Start() { anim = GetComponent <Animator>(); // gets animator on this gameobject SwitchScript = GetComponent <SwitchWeapons>(); // gets switchweapons script on this gameobject moveInput = moveJoystick.GetComponent <MoveVirtualJoystick>(); // gets move joystick script shootInput = shootJoystick.GetComponent <ShootVirtualJoystick>(); // gets shoot joystick script audiosource = GetComponent <AudioSource>(); // used to access audio source component sounds = new AudioClip[] { gunclock, pistolsfx, shotgunsfx, riflesfx }; // puts all sound fx in an array for easy access. }
public float rotateSpeed; // declares rotateSpeed as float // Use this for initialization void Start() { player = GetComponent <Rigidbody2D>(); // stores rigidbody component attached to this gameobject anim = GetComponent <Animator>(); // stores animator component attached to this gameobject moveInput = moveJoystick.GetComponent <MoveVirtualJoystick>(); // stores movevirtualjoystick script shootInput = shootJoystick.GetComponent <ShootVirtualJoystick>(); // stores shootvirtualjoystick script speed = 250f; // speed is set to 250 rotateSpeed = -180f; // speed is set to -180f }