void Start() { _animator = GetComponent <Animator>(); _snapPanel = GetComponentInChildren <SnapPanel>(); _curseImage = GetComponent <WorldspaceImage>(); if (_active) { _snapPanel.Invoke("StartSnapping", _pauseInterval + 2f); } }
public void OnShootGun() { _visualShotAnimator.SetTrigger("VisualShot"); _shotNoise.Play(); GetComponent <AudioSource>().PlayOneShot(_shotAudio); if (Physics.Raycast( _bulletSpawnPosition.position, _target.position - _bulletSpawnPosition.position + Vector3.up * _yOffset, out _shotHit, _maxDistance )) { _visualHitAnimator.transform.position = _shotHit.point; _visualHitAnimator.transform.rotation = CameraControl.active.transform.rotation; _visualHitAnimator.SetTrigger("VisualHit"); if (_shotHit.transform.CompareTag("Player")) { //print("Dead"); //GameObject.Find("GameOver").GetComponent<UnityEngine.UI.Text>().enabled = true; // Debug... Need fix _active = false; _target.GetComponent <SheepController>().Dead = true; } else { //print("Missed"); _curseImage.enabled = true; } } if (_active == true) { _snapPanel.Invoke("StartSnapping", _pauseInterval + 1.3f); } _audioPlayed = false; GetComponentInChildren <RandomBark>().enabled = true; }