public Implementation(GameObject gameObject, FireableWeaponBehavior behavior) : base(gameObject, behavior) { _light = gameObject.GetComponentsInChildren <Light>().First(); _audio = gameObject.GetComponentsInChildren <AudioSource>().First(); _state = FireableWeaponState.None; }
private IEnumerator FireWeapon() { _state = FireableWeaponState.Fired; var light = _light; var audio = _audio; light.enabled = true; audio.Play(); yield return(new WaitForSeconds(0.05f)); light.enabled = false; _state = FireableWeaponState.None; }
/// <inheritdoc /> public void TransitionToState(FireableWeaponState state) { Behavoir.StartCoroutine(FireWeapon()); }
/// <inheritdoc /> public bool CanEnterState(FireableWeaponState state) { return(_state == FireableWeaponState.None); }