protected virtual void Start() { // getting the mask sensor _maskSensor = GetComponent<MaskSensor>(); // we get the player from its tag _playerTransform = GameManager.Instance.Player.transform; if (_playerTransform == null || _maskSensor == null) { Debug.LogError ("Destroying enemy object " + gameObject.name + " since the player variable is not initialized."); GameObject.Destroy (this); } LastFlipToPlayer = Time.time; }
protected virtual void Start() { // getting the mask sensor _maskSensor = GetComponent<MaskSensor>(); // we get the CorgiController2D component _controller = GetComponent<CorgiController>(); // we get the player from its tag _playerTransform = GameManager.Instance.Player.transform; if (_playerTransform == null || _controller == null || _maskSensor == null) { Debug.LogError ("Destroying enemy object " + gameObject.name + " since its variables are not initialized."); GameObject.Destroy (this); } ChangeDirection(); }