Exemple #1
0
 private void Awake()
 {
     _rb                = (Rigidbody)NullChecker.TryGet <Rigidbody>(gameObject);
     _rb.constraints    = RigidbodyConstraints.FreezePositionZ;
     _rb.freezeRotation = true;
     _rb.useGravity     = false;
 }
Exemple #2
0
    private void Awake()
    {
        Collider collider = (BoxCollider)NullChecker.TryGet <BoxCollider>(gameObject);

        _boundaryWrapDistance = collider.bounds.size.x * _collisionScale;

        _rb                = (Rigidbody)NullChecker.TryGet <Rigidbody>(gameObject);
        _rb.constraints    = RigidbodyConstraints.FreezePositionZ;
        _rb.freezeRotation = true;
        _rb.useGravity     = false;
    }
Exemple #3
0
    private void Start()
    {
        _constants = (IConstants)NullChecker
                     .TryFind <Constants>(Tags.Constants, gameObject);

        _gameController = (IGameController)NullChecker
                          .TryFind <GameController>(Tags.GameController, gameObject);

        _cube = GameObject.FindWithTag(Tags.Cube);
        if (_cube == null)
        {
            _cube = new GameObject();
            _cube.AddComponent <CubeHandler>();
        }

        _offset            = _cube.GetComponent <Collider>().bounds.size.x *_collisionScale;
        _cubeEmitters      = NullChecker.TryGet(GameObject.FindGameObjectsWithTag(Tags.CubeEmitter));
        _emitterProperties = new EmitterProperties(_constants, _offset);

        SetEmitterPositions();
        StartCoroutine(EmitCubes());
    }
Exemple #4
0
        public void TryGet_NullGameObject_ReturnsNull()
        {
            var result = NullChecker.TryGet <Rigidbody>(null);

            Assert.That(result, Is.Null);
        }
Exemple #5
0
        public void TryGet_GameObject_ReturnsComponent()
        {
            var result = NullChecker.TryGet <Rigidbody>(new GameObject());

            Assert.That(result, Is.TypeOf <Rigidbody>());
        }