public void Setup()
        {
            cube = new GameObject().AddComponent <MoveController>();
            cube.gameObject.AddComponent <Rigidbody>();
            cube.speed = 1f;

            service = Substitute.For <IUnityService>();
            service.GetDeltaTime().Returns(0.3f);
            life.life      = 100;
            cube.lifeGauge = life;
        }
Пример #2
0
        // Update is called once per frame
        void Update()
        {
            transform.position += movement.Calculate(
                unityService.GetAxis("Horizontal"),
                unityService.GetDeltaTime());

            if (unityService.GetAxis("Horizontal") != 0 &&
                !soundManager.IsPlayingSound(GetComponent <AudioSource>()))
            {
                soundManager.Play(GetComponent <AudioSource>());
            }
        }
Пример #3
0
        public void TestSetUp()
        {
            life         = new GameObject().AddComponent <LifeGauge>();
            life.lifebar = new GameObject().AddComponent <Slider>();
            life.loose   = new GameObject().AddComponent <Text>();
            life.life    = 100;

            moveController = new GameObject().AddComponent <MoveController>();
            moveController.gameObject.AddComponent <Rigidbody>();
            moveController.transform.position = Vector3.one;
            moveController.lifeGauge          = life;

            camera = new GameObject().AddComponent <CameraController>();
            camera.transform.position = new Vector3(3, 3, 3);
            camera.target             = moveController.transform;

            service = Substitute.For <IUnityService>();
            service.GetDeltaTime().Returns(0.5f);
        }
Пример #4
0
 void MoveCharacter()
 {
     myRigidBody.MovePosition(
         transform.position + movement.Calculate(change, unityService.GetDeltaTime())
         );
 }
Пример #5
0
    // Update is called once per frame
    void Update()
    {
        directionFace = _movement.Calculate2D(_unityService.GetAxisRaw("Horizontal"), _unityService.GetAxisRaw("Vertical"), _unityService.GetDeltaTime());
        transform.Translate(directionFace);



        Vector2 input = new Vector2(_unityService.GetAxisRaw("Horizontal"), _unityService.GetAxisRaw("Vertical"));

        _animator.SetFloat("Horizontal", input.x);
        _animator.SetFloat("Vertical", input.y);
        _animator.SetFloat("Magnitude", input.magnitude);


        Attack();
        HandleAnimation(_animator, _rigidbody2D);
    }
Пример #6
0
    // Update is called once per frame
    void Update()
    {
        _direction = _movement.Calculate2D(_unityService.GetAxisRaw("Horizontal"), _unityService.GetAxisRaw("Vertical"), _unityService.GetDeltaTime()).normalized;


        animator.SetFloat("Horizontal", _direction.x);
        animator.SetFloat("Vertical", _direction.y);
        animator.SetFloat("Magnitude", _direction.magnitude);


        Attack();
        HandleAnimation(animator, _rb);
    }