Ejemplo n.º 1
0
 private void Start()
 {
     rbd               = GetComponent <Rigidbody>();
     stats             = GetComponent <Stats>();
     movementDirection = setCameraDirection(cameraView);
     animatorFacade    = new AnimatorFacade(GetComponentInChildren <ICharacterAnimator>(), this);
     initMovements();
     movement        = movements[MovementEnum.Ground];
     healthComponent = new HealthComponent(this);
     armour          = new Armour(this);
     attackManager   = new AttackManager(animatorFacade, this);
 }
Ejemplo n.º 2
0
 //public Transform camPivot;
 //public Animator anim;
 //public float damageMultiply = 1f;
 //public Collider axeBoundingBox;
 private void Start()
 {
     //camPivot = GameObject.FindGameObjectWithTag("CamPivot").transform;
     //anim = GetComponent<Animator>();
     IsRunning         = false;
     rbd               = GetComponent <Rigidbody>();
     stats             = GetComponent <Stats>();
     animator          = new AnimatorFacade(GetComponent <ICharacterAnimator>());
     movement          = new GroundMovement(this);
     attackManager     = GetComponent <IAttack>();
     movementDirection = new ThridPersonCamera();
 }
Ejemplo n.º 3
0
 private void Start()
 {
     _rbd               = GetComponent <Rigidbody>();
     _stats             = GetComponent <Stats>();
     _movementDirection = SetCameraDirection(cameraView);
     _animatorFacade    = new AnimatorFacade(GetComponentInChildren <ICharacterAnimator>(), this);
     InitMovements();                                    // creating all movements
     _movement        = _movements[MovementEnum.Ground]; // setting the current movement as Ground One
     _healthComponent = new HealthComponent(this);
     _armour          = new Armour(this);
     _attackManager   = new AttackManager(_animatorFacade, this);
 }
Ejemplo n.º 4
0
        public IPosition MoveInDirection(IMovementDirection direction)
        {
            if (direction == null)
            {
                throw new ArgumentNullException("direction");
            }

            var nextRow           = this.Row + direction.DeltaRow;
            var nextCol           = this.Col + direction.DeltaCol;
            var resultingPosition = new Position(nextRow, nextCol);

            return(resultingPosition);
        }
        public void GetNext_ShouldReturnTheFirstElement_AfterDirectionSequenceLengthInvokations()
        {
            var basicSequence = new BasicPathDirectionSequence(InstantiatingMethods.CreateDirection);

            var firstDirection = basicSequence.GetNextDirection();
            IMovementDirection actualDirection = null;

            for (int runs = 0; runs < basicSequence.DirectionSequenceLength; runs++)
            {
                actualDirection = basicSequence.GetNextDirection();
            }

            Assert.That(actualDirection.DeltaRow, Is.EqualTo(firstDirection.DeltaRow));
            Assert.That(actualDirection.DeltaCol, Is.EqualTo(firstDirection.DeltaCol));
        }
Ejemplo n.º 6
0
        public IEnumerator moveTest()
        {
            IMovementDirection moveDirection = For <IMovementDirection>();
            var direction = new Vector3(0, 0, 1);

            player.changeMovementDirection(moveDirection);
            moveDirection.getDirection().Returns(direction);
            Vector3 playerInitPosition = playerGo.transform.position;

            Assert.True(player.getMovement() is GroundMovement);
            yield return(new WaitForSeconds(1f));

            Vector3 expectedPosition = playerInitPosition + direction * (player.getStats().speed * 1f);

            Assert.True(Vector3.Distance(expectedPosition, playerGo.transform.position) <= 2f);
            Assert.True(player.getMovement() is GroundMovement);
        }
Ejemplo n.º 7
0
        public IEnumerator SlideTest()
        {
            IMovementDirection moveDirection = For <IMovementDirection>();
            var direction = new Vector3(0, 0, 1);

            player.ChangeMovementDirection(moveDirection);
            moveDirection.GetDirection().Returns(direction);
            player.ChangeMovement(MovementEnum.Slide);
            Vector3 playerInitPosition = playerGo.transform.position;

            Assert.True(player.getMovement() is SlidingMovement);
            yield return(new WaitForSeconds(1f));

            Vector3 expectedPosition = playerInitPosition + direction * player.getStats().slidingSpeed;

            Assert.True(Vector3.Distance(expectedPosition, playerGo.transform.position) <= 1f);
            Assert.True(player.getMovement() is SlidingMovement);
        }
Ejemplo n.º 8
0
 public void changeMovementDirection(CameraView cameraView)
 {
     movementDirection = setCameraDirection(cameraView);
 }
Ejemplo n.º 9
0
 public void changeMovementDirection(IMovementDirection movementDirection)
 {
     this.movementDirection = movementDirection;
 }