Exemplo n.º 1
0
        private void AttackPlayer()
        {
            Vector3 attackDirection = (_player.transform.position - transform.position);

            attackDirection.z             = 0;
            _attackDescription._target    = _player;
            _attackDescription._direction = attackDirection.normalized;
            _weapon.Attack(_attackDescription);
        }
        private void UpdateAttack(Vector3 cursorPosition, WeaponBase weapon)
        {
            var attackDirection = (cursorPosition - transform.position).normalized;

            weapon.transform.position = transform.position + attackDirection * weapon._offsetFromOwner;

            if (Input.GetButton(InputNames.Fire1) && _weapons != null && weapon.IsCooldownOver())
            {
                _attackDescription._direction = attackDirection;
                weapon.Attack(_attackDescription);
            }
        }