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

            if (_magProj != null)
            {
                if (_magnet.forceMagnitude > .01f)
                {
                    _magProj.SeekEnemies(true);
                }
            }
        }
コード例 #2
0
        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();
                }
            }
        }