示例#1
0
        public void IsHitByFrontLegs_ColliderIsFrontLegs_ReturnsTrue()
        {
            var colliderName = "frontLegs";

            _ball.IsHitByFrontLegs(colliderName);
            Assert.IsTrue(_ball.IsHitByFrontLegs(colliderName));
        }
示例#2
0
        private void OnCollisionEnter(Collision other)
        {
            if (!_ball.IsHitByFrontLegs(other.transform.name))
            {
                return;
            }

            var direction = _ball.GetBallShootingDirectionWithForce(other.transform.position, transform.position);

            GetComponent <Rigidbody>().AddForce(direction, ForceMode.Impulse);
        }