示例#1
0
        private void OnTriggerEnter2D(Collider2D collision)
        {
            _magProj = collision.GetComponent <MagneticProjectile>();

            if (_magProj != null)
            {
                if (_magnet.forceMagnitude > .01f)
                {
                    _magProj.SeekEnemies(true);
                }
            }
        }
        protected void OnTriggerEnter2D(Collider2D collision)
        {
            /*if(collision.gameObject.layer == PlayerProjectileLayerMask.value)
             * {
             *  _projectileHealth = collision.GetComponent<Health>();
             *  _projectileHealth.Kill();
             * }*/

            _magProj = collision.GetComponent <MagneticProjectile>();

            if (_magProj != null)
            {
                if (_magProj.CanHurtEnemies)
                {
                    StartCoroutine(PlayLightningFx());
                    _shieldHealth.Kill();
                    _magProj.KillMagenticProjectile();
                }
            }
        }